|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.sdr.util.Tools
public abstract class Tools
Utility functions to facilitate map and list creation.
Nested Class Summary | |
---|---|
static class |
Tools.F<A,B>
Convenience alias for FilterIterator.Filter . |
static interface |
Tools.ListMultiMap<K,V>
An instance of a MultiMap where the
contained collections are List s. |
static interface |
Tools.SetMultiMap<K,V>
An instance of a MultiMap where the
contained collections are Set s. |
Method Summary | ||
---|---|---|
static
|
foreach(List<A> list,
FilterIterator.Filter<A,B> filter)
Quasi-list comprehension. |
|
static
|
l()
|
|
static
|
l(A... items)
Convenience constructor for lists. |
|
static
|
l(A item1)
|
|
static
|
l(A item1,
A item2)
|
|
static
|
l(A item1,
A item2,
A item3)
|
|
static
|
m()
|
|
static
|
m(Map.Entry<A,B>... items)
Convenience constructor for maps, specified as a list of pairs. |
|
static
|
m(Map.Entry<A,B> item)
|
|
static
|
m(Map.Entry<A,B> item1,
Map.Entry<A,B> item2)
|
|
static
|
m(Map.Entry<A,B> item1,
Map.Entry<A,B> item2,
Map.Entry<A,B> item3)
|
|
static
|
m(Map.Entry<A,B> item1,
Map.Entry<A,B> item2,
Map.Entry<A,B> item3,
Map.Entry<A,B> item4)
|
|
static
|
mml()
|
|
static
|
mml(Map.Entry<K,V>... items)
Multimaps of lists. |
|
static
|
mml(Map.Entry<K,V> item1)
|
|
static
|
mml(Map.Entry<K,V> item1,
Map.Entry<K,V> item2)
|
|
static
|
mms()
|
|
static
|
mms(Map.Entry<K,V>... items)
Multimaps of sets. |
|
static
|
mms(Map.Entry<K,V> item1)
|
|
static
|
mms(Map.Entry<K,V> item1,
Map.Entry<K,V> item2)
|
|
static
|
p(A a,
B b)
Convenience constructor for pairs. |
|
static
|
s()
|
|
static
|
s(A... items)
Convenience constructor for sets. |
|
static
|
s(A item1)
|
|
static
|
s(A item1,
A item2)
|
|
static
|
s(A item1,
A item2,
A item3)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <A,B> PairMapEntry<A,B> p(A a, B b)
js> Tools.p(1,2) 1.0=2.0 js> pair=Tools.p('asd',4) asd=4.0 js> pair.getKey() asd js> pair.getValue() 4.0
public static <A,B> Map<A,B> m(Map.Entry<A,B>... items)
p(A, B)
js> map = Tools.m() {} js> map.isEmpty() true js> map = Tools.m(Tools.p(1,2), Tools.p(3,4), Tools.p(5,6)) {1.0=2.0, 3.0=4.0, 5.0=6.0} js> map.get(3) 4.0
js> map = Tools.m(Tools.p(1,2), Tools.p(1,3), Tools.p(1,4)) {1.0=4.0}
public static <A,B> Map<A,B> m()
m(java.util.Map.Entry[])
public static <A,B> Map<A,B> m(Map.Entry<A,B> item)
m(java.util.Map.Entry[])
public static <A,B> Map<A,B> m(Map.Entry<A,B> item1, Map.Entry<A,B> item2)
m(java.util.Map.Entry[])
public static <A,B> Map<A,B> m(Map.Entry<A,B> item1, Map.Entry<A,B> item2, Map.Entry<A,B> item3)
m(java.util.Map.Entry[])
public static <A,B> Map<A,B> m(Map.Entry<A,B> item1, Map.Entry<A,B> item2, Map.Entry<A,B> item3, Map.Entry<A,B> item4)
m(java.util.Map.Entry[])
public static <A> List<A> l(A... items)
js> Tools.l() [] js> ll = Tools.l() [] js> ll.isEmpty() true js> ll = Tools.l('foo') [foo] js> ll.get(0) foo js> ll = Tools.l(1,2,3,2,1) [1.0, 2.0, 3.0, 2.0, 1.0] js> ll.size() 5
public static <A> List<A> l()
l(Object[])
public static <A> List<A> l(A item1)
l(Object[])
public static <A> List<A> l(A item1, A item2)
l(Object[])
public static <A> List<A> l(A item1, A item2, A item3)
l(Object[])
public static <A> Set<A> s(A... items)
js> Tools.s() [] js> ss = Tools.s() [] js> ss.isEmpty() true js> ss = Tools.s('foo') [foo] js> ss.contains('foo') true js> ss = Tools.s(1,2,3,2,1) [1.0, 2.0, 3.0] js> ss.size() 3
public static <A> Set<A> s()
s(Object[])
public static <A> Set<A> s(A item1)
s(Object[])
public static <A> Set<A> s(A item1, A item2)
s(Object[])
public static <A> Set<A> s(A item1, A item2, A item3)
s(Object[])
public static <K,V> Tools.SetMultiMap<K,V> mms(Map.Entry<K,V>... items)
js> map = Tools.mms() {} js> map.isEmpty() true js> map = Tools.mms(Tools.p(1,2), Tools.p(3,4), Tools.p(5,6)) {1.0=2.0, 3.0=4.0, 5.0=6.0} js> map.get(3) 4.0 js> map = Tools.mms(Tools.p(1,2), Tools.p(1,3), Tools.p(1,4)) {1.0=[2.0, 3.0, 4.0]}
js> map = Tools.mms(Tools.p(1,2), Tools.p(1,3), Tools.p(1,2)) {1.0=[2.0, 3.0]}
public static <K,V> Tools.SetMultiMap<K,V> mms()
mml(java.util.Map.Entry[])
public static <K,V> Tools.SetMultiMap<K,V> mms(Map.Entry<K,V> item1)
mml(java.util.Map.Entry[])
public static <K,V> Tools.SetMultiMap<K,V> mms(Map.Entry<K,V> item1, Map.Entry<K,V> item2)
mml(java.util.Map.Entry[])
public static <K,V> Tools.ListMultiMap<K,V> mml(Map.Entry<K,V>... items)
js> map = Tools.mml() {} js> map.isEmpty() true js> map = Tools.mml(Tools.p(1,2), Tools.p(3,4), Tools.p(5,6)) {1.0=2.0, 3.0=4.0, 5.0=6.0} js> map.get(3) 4.0 js> map = Tools.mml(Tools.p(1,2), Tools.p(1,3), Tools.p(1,4)) {1.0=[2.0, 3.0, 4.0]}
js> map = Tools.mml(Tools.p(1,2), Tools.p(1,3), Tools.p(1,2)) {1.0=[2.0, 3.0, 2.0]}
public static <K,V> Tools.ListMultiMap<K,V> mml()
mml(java.util.Map.Entry[])
public static <K,V> Tools.ListMultiMap<K,V> mml(Map.Entry<K,V> item1)
mml(java.util.Map.Entry[])
public static <K,V> Tools.ListMultiMap<K,V> mml(Map.Entry<K,V> item1, Map.Entry<K,V> item2)
mml(java.util.Map.Entry[])
public static <A,B> List<B> foreach(List<A> list, FilterIterator.Filter<A,B> filter)
|
sdr 0.7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |