@Test public void testToArray() { EntryHolder entryHolder = mock(EntryHolder.class); Map map = new HashMap(); map.put("1", "1"); map.put("2", "2"); map.put("3", "3"); ValueCollection valueCollection = new ValueCollection(entryHolder, map.entrySet()); Object[] result = valueCollection.toArray(); assertEquals(3, result.length); List l = Arrays.asList(result); assertTrue(l.containsAll(map.values())); }
public Object[] toArray() { List<V> list = new ArrayList<V>(entrySet.size()); for (Entry<K, V> entry : entrySet) { list.add(entry.getValue()); } return list.toArray(); }
ValueCollection implements Collection<V> { public Object[] toArray() { List<V> list = new ArrayList<V>(entrySet.size()); for (Entry<K, V> entry : entrySet) { list.add(entry.getValue()); } return list.toArray(); } }
ValueCollection implements Collection<V> { public Object[] toArray() { List<V> list = new ArrayList<V>(entrySet.size()); for (Entry<K, V> entry : entrySet) { list.add(entry.getValue()); } return list.toArray(); } ValueCollection(EntryHolder<K, V> proxy, Set<Entry<K, V>> entrySet); }
ValueCollection implements Collection<V> { public Object[] toArray() { List<V> list = new ArrayList<V>(entrySet.size()); for (Entry<K, V> entry : entrySet) { list.add(entry.getValue()); } return list.toArray(); } ValueCollection(EntryHolder<K, V> proxy, Set<Entry<K, V>> entrySet); boolean add(V arg0); boolean addAll(Collection<? extends V> arg0); void clear(); boolean contains(Object arg0); boolean containsAll(Collection<?> arg0); boolean isEmpty(); Iterator<V> iterator(); boolean remove(Object arg0); boolean removeAll(Collection<?> arg0); boolean retainAll(Collection<?> arg0); int size(); Object[] toArray(); T[] toArray(final T[] a); }
ValueCollection implements Collection<V> { public Object[] toArray() { List<V> list = new ArrayList<V>(entrySet.size()); for (Entry<K, V> entry : entrySet) { list.add(entry.getValue()); } return list.toArray(); } ValueCollection(EntryHolder<K, V> proxy, Set<Entry<K, V>> entrySet); boolean add(V arg0); boolean addAll(Collection<? extends V> arg0); void clear(); boolean contains(Object arg0); boolean containsAll(Collection<?> arg0); boolean isEmpty(); Iterator<V> iterator(); boolean remove(Object arg0); boolean removeAll(Collection<?> arg0); boolean retainAll(Collection<?> arg0); int size(); Object[] toArray(); T[] toArray(final T[] a);  }