Class CollectionUtils

java.lang.Object
org.neo4j.ogm.support.CollectionUtils

public final class CollectionUtils extends Object
Utilities around collections.
Author:
Michael J. Simons
  • Method Details

    • iterableOf

      public static Iterable<Object> iterableOf(Object thingToIterable)
      Turns thingToIterable into an iterable. In case of null, it returns an empty collection. Returns the iterable itself when the thing is already iterable. An array will be turned into an iterable. A single object will be returned as a singleton list.
      Parameters:
      thingToIterable - A thing that should be iterated over. Can be null.
      Returns:
      An iterable.
    • materializeIterableIf

      public static Object materializeIterableIf(Object entryValue)
      Parameters:
      entryValue - A value that is needed as a collection.
      Returns:
      Returns a collection if entryValue is iterable but not already a collection.