org.apache.wicket.util.lang
Class Generics

java.lang.Object
  extended by org.apache.wicket.util.lang.Generics

public class Generics
extends Object

Generics related utilities

Author:
igor.vaynberg

Method Summary
static
<T> Iterator<T>
iterator(Iterator<?> delegate)
          Silences generics warning when need to cast iterator types
static
<T> IModel<T>
model(IModel<?> model)
          Supresses generics warning when converting model types
static
<T> ArrayList<T>
newArrayList()
          Creates a new ArrayList
static
<T> ArrayList<T>
newArrayList(int capacity)
          Creates a new ArrayList
static
<K,V> ConcurrentHashMap<K,V>
newConcurrentHashMap()
          Creates a new ConcurrentHashMap
static
<K,V> ConcurrentHashMap<K,V>
newConcurrentHashMap(int initialCapacity)
          Creates a new ConcurrentHashMap
static
<K,V> HashMap<K,V>
newHashMap()
          Creates a new HashMap
static
<K,V> HashMap<K,V>
newHashMap(int capacity)
          Creates a new HashMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

iterator

public static <T> Iterator<T> iterator(Iterator<?> delegate)
Silences generics warning when need to cast iterator types

Type Parameters:
T -
Parameters:
delegate -
Returns:
delegate iterator cast to proper generics type

model

public static <T> IModel<T> model(IModel<?> model)
Supresses generics warning when converting model types

Type Parameters:
T -
Parameters:
model -
Returns:
model

newHashMap

public static <K,V> HashMap<K,V> newHashMap()
Creates a new HashMap

Type Parameters:
K -
V -
Returns:
new hash map

newHashMap

public static <K,V> HashMap<K,V> newHashMap(int capacity)
Creates a new HashMap

Type Parameters:
K -
V -
Parameters:
capacity - initial capacity
Returns:
new hash map

newArrayList

public static <T> ArrayList<T> newArrayList(int capacity)
Creates a new ArrayList

Type Parameters:
T -
Parameters:
capacity - initial capacity
Returns:
array list

newArrayList

public static <T> ArrayList<T> newArrayList()
Creates a new ArrayList

Type Parameters:
T -
Returns:
array list

newConcurrentHashMap

public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap()
Creates a new ConcurrentHashMap

Type Parameters:
K -
V -
Returns:
new hash map

newConcurrentHashMap

public static <K,V> ConcurrentHashMap<K,V> newConcurrentHashMap(int initialCapacity)
Creates a new ConcurrentHashMap

Type Parameters:
K -
V -
Parameters:
initialCapacity - initial capacity
Returns:
new hash map


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.