org.jnario.lib
Class JnarioCollectionLiterals

java.lang.Object
  extended by org.jnario.lib.JnarioCollectionLiterals

public class JnarioCollectionLiterals
extends Object

Shorter versions of the collection literals provided by Xtend.

Author:
Sebastian Benz - Initial contribution and API

Constructor Summary
JnarioCollectionLiterals()
           
 
Method Summary
static
<T> List<T>
list(T... elements)
          Creates a mutable List instance containing the given initial elements.
static
<K,V> Map<K,V>
map(org.eclipse.xtext.xbase.lib.Pair<K,V>... elements)
          Creates a mutable Map instance containing the given initial entries.
static
<T> Set<T>
set(T... elements)
          Creates a mutable Set instance containing the given initial elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JnarioCollectionLiterals

public JnarioCollectionLiterals()
Method Detail

list

public static <T> List<T> list(T... elements)
Creates a mutable List instance containing the given initial elements.

Parameters:
initial - the initial elements that the list should contain, in order. May not be null but may contain null values.
Returns:
a new List containing those elements

set

public static <T> Set<T> set(T... elements)
Creates a mutable Set instance containing the given initial elements.

Parameters:
initial - the initial elements that the set should contain, in order. May not be null but may contain null values.
Returns:
a new Set containing those elements

map

public static <K,V> Map<K,V> map(org.eclipse.xtext.xbase.lib.Pair<K,V>... elements)
Creates a mutable Map instance containing the given initial entries. Repeated occurrences of a keys will cause an IllegalArgumentException.

Parameters:
initial - the entries that should be contained in the map. May not be null but may contain null keys or values.
Returns:
a new Map containing those elements
Throws:
IllegalArgumentException - if duplicate keys are contained the initial entries.


Copyright © 2012-2013 BMW Car IT. All Rights Reserved.