org.robokind.api.common.utils
Class ListUtils

java.lang.Object
  extended by org.robokind.api.common.utils.ListUtils

public class ListUtils
extends Object

Utility methods for working with Lists.

Author:
Matthew Stevenson

Constructor Summary
ListUtils()
           
 
Method Summary
static List<Point2D> deepCopy(List<Point2D> list)
          Returns a deep copy of a list of Point2D.
static
<T> List<T>
filterType(List list, Class<T> cls)
          Returns the items in the given list which match the given class.
static List<Integer[]> findConsecutiveSequences(Integer[] vals)
          Takes an array of unsorted integers with no repeated values.
static float[] parseFloats(String... fStrs)
          Returns an array of floats parsed from the given strings.
 
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

parseFloats

public static float[] parseFloats(String... fStrs)
Returns an array of floats parsed from the given strings.

Parameters:
fStrs - strings to parse
Returns:
array of floats parsed from the given strings

deepCopy

public static List<Point2D> deepCopy(List<Point2D> list)
Returns a deep copy of a list of Point2D.

Parameters:
list - points to copy
Returns:
deep copy of a list of Point2D

findConsecutiveSequences

public static List<Integer[]> findConsecutiveSequences(Integer[] vals)
Takes an array of unsorted integers with no repeated values. Sorts it into arrays of consecutive numbers.

Parameters:
vals - unsorted array of integer without repeats
Returns:
List of arrays of consecutive numbers

filterType

public static <T> List<T> filterType(List list,
                                     Class<T> cls)
Returns the items in the given list which match the given class.

Type Parameters:
T - class to match
Parameters:
list - items to filter
cls - class to match
Returns:
items in the given list which match the given class


Copyright © 2011. All Rights Reserved.