net.sf.jzeno.util
Class ListUtils

java.lang.Object
  extended by net.sf.jzeno.util.ListUtils

public class ListUtils
extends java.lang.Object

Utilities for manipulating Lists.


Constructor Summary
ListUtils()
           
 
Method Summary
static java.lang.String createInClause(java.util.Collection beans)
           Creates a HQL 'in' clause, usefull if you which to create an in-clause for a list of AbstractEntities, like in session.delete("from type t where t.id in (12, 34, 67, 11 , 1")");
static java.lang.Object find(java.util.Collection objectList, long id)
           Convenience wrapper that allow you to specify a long as object Id
static java.lang.Object find(java.util.Collection objectList, java.lang.Object idValue)
           
static java.lang.Object find(java.util.Collection objectList, java.lang.String propertyName, java.lang.Object object)
           
static java.lang.Object find(java.util.Collection objectList, java.lang.String propertyName, java.lang.String propertyValue)
           
static java.lang.Object findFirst(java.util.List list)
           Gets first element from list
static java.lang.Object findLast(java.util.List list)
           Gets last element from list
static java.lang.String getIdentifierPropertyName(java.lang.Class clazz)
           
static java.util.List getSortedUniqueList(java.util.Collection unsorted, java.lang.String property)
           
static int index(java.util.Collection objectList, java.lang.Object element)
           
static java.util.List removeDuplicates(java.util.List list)
           This operation removes duplicate elements from a list.
static boolean removeElement(java.util.Collection col, java.lang.Object o)
           This operation removes the elements from a collection.
static java.util.List removeElements(java.util.List list, java.util.List elementList)
           This operation removes elements from elementList out list
static void removeNulls(java.util.List list)
           This operation removes the null elements from a collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListUtils

public ListUtils()
Method Detail

index

public static int index(java.util.Collection objectList,
                        java.lang.Object element)

find

public static java.lang.Object find(java.util.Collection objectList,
                                    java.lang.Object idValue)

find

public static java.lang.Object find(java.util.Collection objectList,
                                    java.lang.String propertyName,
                                    java.lang.String propertyValue)

find

public static java.lang.Object find(java.util.Collection objectList,
                                    java.lang.String propertyName,
                                    java.lang.Object object)

find

public static java.lang.Object find(java.util.Collection objectList,
                                    long id)

Convenience wrapper that allow you to specify a long as object Id


findFirst

public static java.lang.Object findFirst(java.util.List list)

Gets first element from list


findLast

public static java.lang.Object findLast(java.util.List list)

Gets last element from list


getIdentifierPropertyName

public static java.lang.String getIdentifierPropertyName(java.lang.Class clazz)

createInClause

public static java.lang.String createInClause(java.util.Collection beans)

Creates a HQL 'in' clause, usefull if you which to create an in-clause for a list of AbstractEntities, like in session.delete("from type t where t.id in (12, 34, 67, 11 , 1")");


removeDuplicates

public static java.util.List removeDuplicates(java.util.List list)

This operation removes duplicate elements from a list. This is useful for thing list a join fetch query that returns parent objects more than once.


removeElements

public static java.util.List removeElements(java.util.List list,
                                            java.util.List elementList)

This operation removes elements from elementList out list


removeNulls

public static void removeNulls(java.util.List list)

This operation removes the null elements from a collection. It modifies the passed in collection !


removeElement

public static boolean removeElement(java.util.Collection col,
                                    java.lang.Object o)

This operation removes the elements from a collection. It modifies the passed in collection !


getSortedUniqueList

public static java.util.List getSortedUniqueList(java.util.Collection unsorted,
                                                 java.lang.String property)