Class Views
java.lang.Object
org.glassfish.jersey.internal.util.collection.Views
- Author:
- Pavel Bucek
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
R> List<T> Create aList
view, which transforms the values of provided original list.static <K,
V, O> Map<K, V> Create aMap
view, which transforms the values of provided original map.static <E> Set<E>
setDiffView
(Set<? extends E> set1, Set<? extends E> set2) Create a view of a difference of provided sets, i.e. the diff filters out from the first set the items included in the second set.static <E> Set<E>
setUnionView
(Set<? extends E> set1, Set<? extends E> set2) Create a view of an union of provided sets.
-
Method Details
-
listView
Create aList
view, which transforms the values of provided original list.Removing elements from the view is supported, adding and setting isn't and throws
UnsupportedOperationException
when invoked.- Type Parameters:
T
- transformed type parameter.R
- type of the element from provided list.- Parameters:
originalList
- original list.transformer
- transforming functions.- Returns:
- transformed list view.
-
mapView
Create aMap
view, which transforms the values of provided original map.Removing elements from the map view is supported, adding and setting isn't and throws
UnsupportedOperationException
when invoked.- Type Parameters:
K
- key type.V
- transformed value type.O
- original value type.- Parameters:
originalMap
- provided map.valuesTransformer
- values transformer.- Returns:
- transformed map view.
-
setUnionView
Create a view of an union of provided sets.View is updated whenever any of the provided set changes.
- Type Parameters:
E
- set item type.- Parameters:
set1
- first set.set2
- second set.- Returns:
- union view of given sets.
-
setDiffView
Create a view of a difference of provided sets, i.e. the diff filters out from the first set the items included in the second set.View is updated whenever any of the provided set changes.
- Type Parameters:
E
- set item type.- Parameters:
set1
- first set.set2
- second set.- Returns:
- view that is a difference of given sets.
-