//////////////////////////////////////////////////////////////////////////////
// 
//                    Copyright 2015, Cornutum Project
//                             www.cornutum.org
//
//////////////////////////////////////////////////////////////////////////////

package org.cornutum.tcases.util;

import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

/**
 * Defines methods for handling collections.
 */
public final class CollectionUtils
  {
  /**
   * Creates a new CollectionUtils object.
   */
  private CollectionUtils()
    {
    // Static methods only
    }

  /**
   * Returns a stream that produces the sequence defined by the given Iterator.
   */
  static public <T> Stream<T> toStream( Iterator<T> iterator)
    {
    Iterable<T> iterable = () -> iterator;
    return StreamSupport.stream( iterable.spliterator(), false);
    }
  }

@@ -314,24 +314,75 @@
 va.util.
-Iterator
+Collection;%0Aimport java.util.Iterator;%0Aimport java.util.Map
 ;%0Aimport
@@ -760,19 +760,19 @@
 /%0A  
-static publ
+public stat
 ic %3C
@@ -935,13 +935,530 @@
 );%0A    %7D
+%0A%0A  /**%0A   * Returns a stream containing the members of the given collection.%0A   */%0A  public static %3CT,C extends Collection%3CT%3E%3E Stream%3CT%3E membersOf( C collection)%0A    %7B%0A    return%0A      collection == null%0A      ? Stream.empty()%0A      : collection.stream();%0A    %7D%0A%0A  /**%0A   * Returns a stream containing the entries of the given map.%0A   */%0A  public static %3CK,V,M extends Map%3CK,V%3E%3E Stream%3CMap.Entry%3CK,V%3E%3E entriesOf( M map)%0A    %7B%0A    return%0A      map == null%0A      ? Stream.empty()%0A      : map.entrySet().stream();%0A    %7D
 %0A  %7D%0A

Add methods to return values for nullable collection arguments