Ejemplo n.º 1
0
 @SuppressWarnings("unchecked")
 @Override
 public <T> T[] toArray(T[] a) {
   // TODO: Optimize this to only allocate a new array if the set size
   // is larger than the array.length. If the set size is smaller than
   // the array.length then copy the data into the array and set the
   // last element in the array to be null.
   final T[] resizedArray =
       (T[])
           Array.newInstance(
               a.getClass().getComponentType(), complete(asyncSet.getAsImmutableSet()).size());
   return complete(asyncSet.getAsImmutableSet()).toArray(resizedArray);
 }
Ejemplo n.º 2
0
 @Override
 public Object[] toArray() {
   return complete(asyncSet.getAsImmutableSet()).stream().toArray();
 }
Ejemplo n.º 3
0
 @Override
 public Iterator<E> iterator() {
   return complete(asyncSet.getAsImmutableSet()).iterator();
 }