|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfaa.tg.util.adapter.Adapters
public class Adapters
This is a utility class for hanging utility methods based off of Adapter.See the source: Adapters.java
| Nested Class Summary | |
|---|---|
private static class |
Adapters.AdaptedCollection<F,T>
|
private static class |
Adapters.AdaptedEntry<K,V,L,W>
|
private static class |
Adapters.AdaptedEntryIterator<K,V,L,W>
|
private static class |
Adapters.AdaptedEntrySet<K,V,L,W>
|
private static class |
Adapters.AdaptedIterable<F,T>
|
private static class |
Adapters.AdaptedIterator<F,T>
|
private static class |
Adapters.ArbitraryIteratorIterable<C,V>
|
private static class |
Adapters.ArrayAdapter<T>
|
private static class |
Adapters.ArrayIterator<T>
|
private static class |
Adapters.ConvertedMap<K,V,W>
|
private static class |
Adapters.DequeReverserAdapter<F>
|
private static class |
Adapters.FilteredIterable<T>
|
private static class |
Adapters.FilteredIterator<T>
|
private static class |
Adapters.IdentityAdapter<V>
|
private static class |
Adapters.MapBackedAdapter<K,V>
|
private static class |
Adapters.MergedAdapter<F,T,P>
|
private static class |
Adapters.SetFilter<T>
|
private static class |
Adapters.UpcastingIterator<V>
|
| Field Summary | |
|---|---|
static Adapter<java.lang.Enum<?>,java.lang.String> |
ENUM_NAME
|
| Constructor Summary | |
|---|---|
Adapters()
|
|
| Method Summary | ||
|---|---|---|
static
|
arrayIterator(T[] array)
Wraps an array with an iterable. |
|
static
|
arrayIterator(T[] array,
int start,
int end)
Wraps an array with an iterable. |
|
static
|
containedWithin(java.util.Set<? super T> set)
Creates a filter that accepts only the objects that are within the given set. |
|
static
|
convertCollection(java.util.Collection<? extends F> source,
Adapter<? super F,? extends T> adapter)
Creates a view of the given Collection via the given adapter. |
|
static
|
convertEntrySet(java.util.Map<K,V> map,
Adapter<? super K,? extends L> keyAdapter)
Batch converts a map into an entry Set. |
|
static
|
convertEntrySet(java.util.Map<K,V> map,
Adapter<? super K,? extends L> keyAdapter,
Adapter<? super V,? extends W> valueAdapter)
Batch converts a map into an entry Set. |
|
static
|
convertIterable(java.lang.Iterable<? extends F> source,
Adapter<? super F,? extends T> adapter)
Creates a view of the given Iterable via the given adapter. |
|
static
|
fillMap(java.util.Map<? super K,V> map,
java.lang.Iterable<? extends V> iterable,
Adapter<? super V,? extends K> adapter)
Converts all objects inside an iterable with the adapter provided and adds them to the given map. |
|
static
|
filter(java.lang.Iterable<? extends T> iter,
Filter<? super T> filter)
Filters an iterable by the filter provided, where the iterable contains only the objects that are accepted by the filter. |
|
static
|
identityAdapter(java.lang.Class<V> clazz)
Creates an adapter that just returns whatever is given to it. |
|
static
|
interpretedMap(java.util.Map<K,? extends V> map,
Adapter<? super V,? extends W> adapter)
Creates an interpreted map by using the adapter and backing map provided. |
|
static
|
invert(Filter<? super T> filter)
Uses a filter to create another that accepts only the objects that are rejected by the source filter. |
|
static
|
iterableOver(C source,
Adapter<? super C,java.util.Iterator<V>> adapter)
Creates an iterable from a source and an adapter. |
|
static
|
merge(Adapter<? super F,? extends T> first,
Adapter<? super T,? extends P> second)
Merges two adapters transitively to make another. |
|
static
|
notWithin(java.util.Set<? super T> set)
Creates a filter that rejects only the objects that are within the given set. |
|
static
|
reversedDeque(java.util.Deque<? extends V> source)
Reverses a deque. |
|
static
|
subtract(java.lang.Iterable<? extends T> modified,
Filter<? super T> filter)
Removes all elements of the iterable that are accepted by the filter. |
|
static
|
subtract(java.lang.Iterable<? extends T> modified,
java.util.Set<? super T> set)
Removes all elements of the iterable that are within the set provided. |
|
static
|
synchronizedConvertArrayRange(java.util.List<F> list,
Adapter<? super F,? extends T> adapter,
int i,
int f)
Creates an range-bounded Iterable from a list in a thread-safe manner. |
|
static
|
toAdapter(java.util.Map<? super K,? extends V> map)
Makes an Adapter |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Adapter<java.lang.Enum<?>,java.lang.String> ENUM_NAME
| Constructor Detail |
|---|
public Adapters()
| Method Detail |
|---|
public static final <F,T> java.util.Collection<T> convertCollection(java.util.Collection<? extends F> source,
Adapter<? super F,? extends T> adapter)
F - the existing type of CollectionT - the type of Collection to convert to.source - the collection to convert.adapter - how to convert Objects of type F into Objects of type T
public static final <F,T> java.lang.Iterable<T> convertIterable(java.lang.Iterable<? extends F> source,
Adapter<? super F,? extends T> adapter)
F - the existing type of IterableT - the type of Collection to convert to.source - the collection to convert.adapter - how to convert Objects of type F into Objects of type T
public static final <K,V> void fillMap(java.util.Map<? super K,V> map,
java.lang.Iterable<? extends V> iterable,
Adapter<? super V,? extends K> adapter)
K - the mediating key typeV - the value type of the map.map - the map to add to.iterable - the iterable to add from.adapter - the adapter to convert with.public static <V> java.lang.Iterable<V> reversedDeque(java.util.Deque<? extends V> source)
V - source - the deque to reverse.
public static <C,V> java.lang.Iterable<V> iterableOver(C source,
Adapter<? super C,java.util.Iterator<V>> adapter)
C - V - source - adapter -
public static <T> java.lang.Iterable<T> arrayIterator(T[] array)
T - array -
public static <T> java.lang.Iterable<T> arrayIterator(T[] array,
int start,
int end)
T - array - start - the starting index to iterate over.end - the ending condition value. Equivalent to the end index - 1
public static <F,T> java.lang.Iterable<T> synchronizedConvertArrayRange(java.util.List<F> list,
Adapter<? super F,? extends T> adapter,
int i,
int f)
F - the type of the listT - what to convert to.list - the source list of adapter - how to convert from i - the starting index to iterate over.f - the ending condition value. Equivalent to the end index - 1
public static final <F,T,P> Adapter<F,P> merge(Adapter<? super F,? extends T> first,
Adapter<? super T,? extends P> second)
F - the type the first adapter converts into type TT - the type the first adapter converts to and what the second adapter
converts into type PP - the type the second adapter converts objects of type T to.first - the adapter equivalent to the function h.second - the adapter equivalent to the function g.
public static final <K,V> Adapter<K,V> toAdapter(java.util.Map<? super K,? extends V> map)
K - the key type of the map and what to convert from in the adapter.V - the value type of the map and what to convert to in the adapter.map - the map to use as a backing for the returned adapter.
public static final <K,V,L,W> java.util.Set<java.util.Map.Entry<L,W>> convertEntrySet(java.util.Map<K,V> map,
Adapter<? super K,? extends L> keyAdapter,
Adapter<? super V,? extends W> valueAdapter)
Map.Entry
public static final <K,V,L> java.util.Set<java.util.Map.Entry<L,V>> convertEntrySet(java.util.Map<K,V> map,
Adapter<? super K,? extends L> keyAdapter)
Map.Entrypublic static final <V> Adapter<V,V> identityAdapter(java.lang.Class<V> clazz)
public static final <T> java.lang.Iterable<T> filter(java.lang.Iterable<? extends T> iter,
Filter<? super T> filter)
T - mediating type between the filter and the iterable.iter - the source iteratable to filter.filter - determines if an element should be added.
public static final <T> Filter<T> containedWithin(java.util.Set<? super T> set)
T - set - which containment determines acceptance
public static final <T> Filter<T> notWithin(java.util.Set<? super T> set)
T - set - which containment determines acceptance
public static final <T> void subtract(java.lang.Iterable<? extends T> modified,
java.util.Set<? super T> set)
T - mediating type between the set and the iterable.modified - the iterable to remove from.set - that consists of elements that should be removed if they are
within the modified set.
public static final <T> void subtract(java.lang.Iterable<? extends T> modified,
Filter<? super T> filter)
T - mediating type between the filter and the iterable.modified - the iterable to remove fromfilter - the filter that accepts the things that should be removed.public static final <T> Filter<T> invert(Filter<? super T> filter)
T - filter - the backing filter.
public static <K,V,W> java.util.Map<K,W> interpretedMap(java.util.Map<K,? extends V> map,
Adapter<? super V,? extends W> adapter)
K - the key type of the mapsV - the intersecting type of the values of the backing map. That is, a type that accepted by both the map
and the adapter provided.W - the new value type of the interpreted map.map - the source mapadapter - the adapter to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||