org.infinispan.util
Class InfinispanCollections

java.lang.Object
  extended by org.infinispan.util.InfinispanCollections

public class InfinispanCollections
extends Object

Static helpers for Infinispan-specific collections

Since:
4.0
Author:
Manik Surtani

Nested Class Summary
static interface InfinispanCollections.Function<E,T>
          A function that converts a type into another one.
static interface InfinispanCollections.MapMakerFunction<K,V,E>
          A function that converts an entry into a key/value pair for use in a map.
 
Field Summary
static BidirectionalMap EMPTY_BIDI_MAP
           
 
Constructor Summary
InfinispanCollections()
           
 
Method Summary
static
<K,V> BidirectionalMap<K,V>
emptyBidirectionalMap()
           
static
<T> ReversibleOrderedSet<T>
emptyReversibleOrderedSet()
           
static
<K,V,E> Map<K,V>
transformCollectionToMap(Collection<E> input, InfinispanCollections.MapMakerFunction<K,V,E> f)
          Given a collection, transforms the collection to a map given a InfinispanCollections.MapMakerFunction
static
<K,V,E> Map<K,V>
transformMapValue(Map<K,E> input, InfinispanCollections.Function<E,V> f)
          Given a map of well known key/value types, it makes a shallow copy of it while at the same time transforming it's value type to a desired output type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_BIDI_MAP

public static final BidirectionalMap EMPTY_BIDI_MAP
Constructor Detail

InfinispanCollections

public InfinispanCollections()
Method Detail

emptyReversibleOrderedSet

public static <T> ReversibleOrderedSet<T> emptyReversibleOrderedSet()

emptyBidirectionalMap

public static <K,V> BidirectionalMap<K,V> emptyBidirectionalMap()

transformMapValue

public static <K,V,E> Map<K,V> transformMapValue(Map<K,E> input,
                                                 InfinispanCollections.Function<E,V> f)
Given a map of well known key/value types, it makes a shallow copy of it while at the same time transforming it's value type to a desired output type. The transformation of the value type is done using a given a function.

Type Parameters:
K - input map's key type
V - desired output type of the map's value
E - input map's value type
Parameters:
input - contains the input key/value pair map
f - function instance to use to transform the value part of the map
Returns:
a shallow copy of the input Map with all its values transformed.

transformCollectionToMap

public static <K,V,E> Map<K,V> transformCollectionToMap(Collection<E> input,
                                                        InfinispanCollections.MapMakerFunction<K,V,E> f)
Given a collection, transforms the collection to a map given a InfinispanCollections.MapMakerFunction

Type Parameters:
K - output map's key type
V - output type of the map's value
E - input collection's entry type
Parameters:
input - contains a collection of type E
f - MapMakerFunction instance to use to transform the collection to a key/value pair
Returns:
a Map with keys and values generated from the input collection

-->

Copyright © 2011 JBoss, a division of Red Hat. All Rights Reserved.