Package com.forgerock.opendj.util
Class Collections2
- java.lang.Object
-
- com.forgerock.opendj.util.Collections2
-
public final class Collections2 extends Object
AdditionalCollectionbased utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <M,N,E0 extends RuntimeException,E1 extends RuntimeException>
Collection<N>transformedCollection(Collection<M> collection, org.forgerock.util.Function<? super M,? extends N,E0> funcMtoN, org.forgerock.util.Function<? super N,? extends M,E1> funcNtoM)Returns a view ofcollectionwhose values have been mapped to elements of typeNusingfuncMtoN.static <M,N,E0 extends RuntimeException,E1 extends RuntimeException>
List<N>transformedList(List<M> list, org.forgerock.util.Function<? super M,? extends N,E0> funcMtoN, org.forgerock.util.Function<? super N,? extends M,E1> funcNtoM)Returns a view oflistwhose values have been mapped to elements of typeNusingfuncMtoN.
-
-
-
Method Detail
-
transformedCollection
public static <M,N,E0 extends RuntimeException,E1 extends RuntimeException> Collection<N> transformedCollection(Collection<M> collection, org.forgerock.util.Function<? super M,? extends N,E0> funcMtoN, org.forgerock.util.Function<? super N,? extends M,E1> funcNtoM)
Returns a view ofcollectionwhose values have been mapped to elements of typeNusingfuncMtoN. The returned collection supports all operations.- Type Parameters:
M- The type of elements contained incollection.N- The type of elements contained in the returned collection.E0- The type of exception thrown byfuncMtoN.E1- The type of exception thrown byfuncNtoM.- Parameters:
collection- The collection to be transformed.funcMtoN- A function which maps values of typeMto values of typeN. This function will be used when retrieving values fromcollection.funcNtoM- A function which maps values of typeNto values of typeM. This function will be used when performing queries and adding values tocollection.- Returns:
- A view of
collectionwhose values have been mapped to elements of typeNusingfuncMtoN.
-
transformedList
public static <M,N,E0 extends RuntimeException,E1 extends RuntimeException> List<N> transformedList(List<M> list, org.forgerock.util.Function<? super M,? extends N,E0> funcMtoN, org.forgerock.util.Function<? super N,? extends M,E1> funcNtoM)
Returns a view oflistwhose values have been mapped to elements of typeNusingfuncMtoN. The returned list supports all operations.- Type Parameters:
M- The type of elements contained inlist.N- The type of elements contained in the returned list.E0- The type of exception thrown byfuncMtoN.E1- The type of exception thrown byfuncNtoM.- Parameters:
list- The list to be transformed.funcMtoN- A function which maps values of typeMto values of typeN. This function will be used when retrieving values fromlist.funcNtoM- A function which maps values of typeNto values of typeM. This function will be used when performing queries and adding values tolist.- Returns:
- A view of
listwhose values have been mapped to elements of typeNusingfuncMtoN.
-
-