be.fgov.ehealth.etee.crypto.utils
Class Iterables

java.lang.Object
  extended by be.fgov.ehealth.etee.crypto.utils.Iterables

public final class Iterables
extends java.lang.Object

A utility class to work easily with instances of Iterable. This class consists of factory methods that allow creation of a new Collection. These methods will infer the type of the collection.


Method Summary
static
<T> T
first(java.lang.Iterable<T> iterable)
          Retrieve the first item from an Iterable.
static
<T> java.util.List<T>
newImmutableList(java.util.List<? extends T> list)
          Create a new immutable instance of List preloaded with a given list of items.
static
<T> java.util.List<T>
newImmutableList(T... items)
          Create a new immutable instance of List loaded with a dynamic list of items.
static
<T> java.util.List<T>
newList()
          Create a new instance of List.
static
<T> java.util.List<T>
newList(T... items)
          Create a new instance of List preloaded with a dynamic list of items.
static
<T> java.util.Set<T>
newSet()
          Creates a new instance of Set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newList

public static <T> java.util.List<T> newList()
Create a new instance of List. This method will return a new ArrayList.

Returns:
A new instance of List

newList

public static <T> java.util.List<T> newList(T... items)
Create a new instance of List preloaded with a dynamic list of items. This method will return a new ArrayList.

Parameters:
items - A dynamic list of items that needs to be added to the list.
Returns:
A new instance of List preloaded with the given items.

newImmutableList

public static <T> java.util.List<T> newImmutableList(java.util.List<? extends T> list)
Create a new immutable instance of List preloaded with a given list of items.

Parameters:
list - An instance of List that contains items that need to be added to the immutable list.
Returns:
A new immutable instance of List.

newImmutableList

public static <T> java.util.List<T> newImmutableList(T... items)
Create a new immutable instance of List loaded with a dynamic list of items. These items shouldn't be null or this method will throw an IllegalArgumentException.

Parameters:
items - A dynamic list of items that should be loaded in the immutable list.
Returns:
A new immutable instance of List

newSet

public static <T> java.util.Set<T> newSet()
Creates a new instance of Set. This method will return a new instance of HashSet.

Returns:
A new instance of Set

first

public static <T> T first(java.lang.Iterable<T> iterable)
Retrieve the first item from an Iterable.

Parameters:
iterable - The iterable to retrieve the first item from.
Returns:
The first item from the given Iterable


Copyright © 2019 eHealth. All Rights Reserved.