Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::ListUtils Class Reference

#include <ListUtils.h>

List of all members.


Detailed Description

Here you can find functions for handling lists.


Static Public Methods

template<class T> void reverse (List< T > &lst)
 Reverse the order of elements in a list (in-place).

template<class T> int findFirstNotOf (const List< T > &lst, const T &value) throw (InvalidArgumentException&)
 Finds the first element form the list which is not same as given value.

template<class T> List< T > selectRandomly (const List< T > &lst, int n) throw (InvalidArgumentException&)
 Randomly select n items from a list.

template<class T> List< List< T > > splitRandomly (const List< T > &lst, int n) throw (InvalidArgumentException&)
 Randomly split lst into two pieces containing n and size-n items, respectively.

template<class T> int maxIndex (const List< T > &lst) throw (InvalidArgumentException&)
 Finds the index of maximum value of the list.

template<class T> int minIndex (const List< T > &lst) throw (InvalidArgumentException&)
 Finds the index of minimum value of the list.

List< std::string > createList (int argc, char *const *argv)
 Create a list of strings out of an array of char pointers.


Member Function Documentation

List< string > util::ListUtils::createList int    argc,
char *const *    argv
[static]
 

Create a list of strings out of an array of char pointers.

This method is useful for example in parsing command-line arguments.

Parameters:
argc  the number of items in argv
argv  an array of strings (char pointers)

template<class T>
int util::ListUtils::findFirstNotOf const List< T > &    lst,
const T &    value
throw (InvalidArgumentException&) [static]
 

Finds the first element form the list which is not same as given value.

Returns:
the index of value found. if different values is not found will be returned -1.


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.