@Test public void testToArray() throws Exception { fillSet(10, set); Object[] arr = set.toArray(); assertEquals("The array should be of length 10.", 10, arr.length); for (int i = 0; i < 10; i++) { assertTrue("All elements of the array should be in the set.", set.contains(arr[i])); } }
@Override public Object[] toArray() { Object[] retArray = new Object[items.size()]; int index = 0; Iterator<byte[]> iterator = items.iterator(); while (iterator.hasNext()) { retArray[index] = serializer.decode(iterator.next()); index++; } return retArray; }
PersistentSet implements Set<E> { @Override public Object[] toArray() { Object[] retArray = new Object[items.size()]; int index = 0; Iterator<byte[]> iterator = items.iterator(); while (iterator.hasNext()) { retArray[index] = serializer.decode(iterator.next()); index++; } return retArray; } }
PersistentSet implements Set<E> { @Override public Object[] toArray() { Object[] retArray = new Object[items.size()]; int index = 0; Iterator<byte[]> iterator = items.iterator(); while (iterator.hasNext()) { retArray[index] = serializer.decode(iterator.next()); index++; } return retArray; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); }
PersistentSet implements Set<E> { @Override public Object[] toArray() { Object[] retArray = new Object[items.size()]; int index = 0; Iterator<byte[]> iterator = items.iterator(); while (iterator.hasNext()) { retArray[index] = serializer.decode(iterator.next()); index++; } return retArray; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); void readInto(Set<E> items); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean add(E item); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends E> c); @Override boolean retainAll(Collection<?> c); @Override boolean removeAll(Collection<?> c); @Override void clear(); @Override boolean equals(Object set); @Override int hashCode(); }
PersistentSet implements Set<E> { @Override public Object[] toArray() { Object[] retArray = new Object[items.size()]; int index = 0; Iterator<byte[]> iterator = items.iterator(); while (iterator.hasNext()) { retArray[index] = serializer.decode(iterator.next()); index++; } return retArray; } PersistentSet(org.onosproject.store.service.Serializer serializer, DB database, String name); void readInto(Set<E> items); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<E> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override boolean add(E item); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends E> c); @Override boolean retainAll(Collection<?> c); @Override boolean removeAll(Collection<?> c); @Override void clear(); @Override boolean equals(Object set); @Override int hashCode();  }