games.strategy.util
Class Util

java.lang.Object
  extended by games.strategy.util.Util

public class Util
extends java.lang.Object

Some utility methods for dealing with collections.

Version:
1.0
Author:
Sean Bridges

Method Summary
static java.lang.String createUniqueTimeStamp()
           
static
<T> java.util.List<T>
difference(java.util.Collection<T> c1, java.util.Collection<T> c2)
          Returns a such that a exists in c1 but not in c2.
static
<T> boolean
equals(java.util.Collection<T> c1, java.util.Collection<T> c2)
          true if for each a in c1, a exists in c2, and if for each b in c2, b exist in c1 and c1 and c2 are the same size.
static
<T> java.util.List<T>
intersection(java.util.Collection<T> c1, java.util.Collection<T> c2)
          return a such that a exists in c1 and a exists in c2.
static boolean isMailValid(java.lang.String emailAddress)
          allow multiple fully qualified email adresses seperated by spaces, or a blank string
static
<T> java.util.List<T>
shiftElementsToEnd(java.util.List<T> source, int count)
          returns a list of everything in source, with the first count units moved to the end
static
<T> boolean
someIntersect(java.util.Collection<T> c1, java.util.Collection<T> c2)
          Equivalent to !
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

intersection

public static <T> java.util.List<T> intersection(java.util.Collection<T> c1,
                                                 java.util.Collection<T> c2)
return a such that a exists in c1 and a exists in c2. always returns a new collection.


someIntersect

public static <T> boolean someIntersect(java.util.Collection<T> c1,
                                        java.util.Collection<T> c2)
Equivalent to !intersection(c1,c2).isEmpty(), but more effecient.

Returns:
true if some element in c1 is in c2

difference

public static <T> java.util.List<T> difference(java.util.Collection<T> c1,
                                               java.util.Collection<T> c2)
Returns a such that a exists in c1 but not in c2. Always returns a new collection.


equals

public static <T> boolean equals(java.util.Collection<T> c1,
                                 java.util.Collection<T> c2)
true if for each a in c1, a exists in c2, and if for each b in c2, b exist in c1 and c1 and c2 are the same size. Note that (a,a,b) (a,b,b) are equal.


shiftElementsToEnd

public static <T> java.util.List<T> shiftElementsToEnd(java.util.List<T> source,
                                                       int count)
returns a list of everything in source, with the first count units moved to the end


isMailValid

public static boolean isMailValid(java.lang.String emailAddress)
allow multiple fully qualified email adresses seperated by spaces, or a blank string


createUniqueTimeStamp

public static java.lang.String createUniqueTimeStamp()