public class Views extends Object
Modifier and Type | Method and Description |
---|---|
static <T,R> List<T> |
listView(List<R> originalList,
Function<R,T> transformer)
Create a
List view, which transforms the values of provided original list. |
static <K,V,O> Map<K,V> |
mapView(Map<K,O> originalMap,
Function<O,V> valuesTransformer)
Create a
Map 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.
|
static <E> Set<E> |
setUnionView(Set<? extends E> set1,
Set<? extends E> set2)
Create a view of an union of provided sets.
|
public static <T,R> List<T> listView(List<R> originalList, Function<R,T> transformer)
List
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.
T
- transformed type parameter.R
- type of the element from provided list.originalList
- original list.transformer
- transforming functions.public static <K,V,O> Map<K,V> mapView(Map<K,O> originalMap, Function<O,V> valuesTransformer)
Map
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.
K
- key type.V
- transformed value type.O
- original value type.originalMap
- provided map.valuesTransformer
- values transformer.public static <E> Set<E> setUnionView(Set<? extends E> set1, Set<? extends E> set2)
View is updated whenever any of the provided set changes.
E
- set item type.set1
- first set.set2
- second set.public static <E> Set<E> setDiffView(Set<? extends E> set1, Set<? extends E> set2)
View is updated whenever any of the provided set changes.
E
- set item type.set1
- first set.set2
- second set.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.