databionics.text
Class StringList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.AbstractSequentialList<E>
              extended by java.util.LinkedList
                  extended by databionics.text.StringList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.Queue

public class StringList
extends java.util.LinkedList

A LinkedList of Strings.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
StringList()
          Standard constructor without arguments.
StringList(java.util.Collection collection)
          Constructor with a collection of objects.
StringList(java.lang.String s)
          Constructor with a single string.
StringList(StringList list)
           
 
Method Summary
 void addAll(StringList items)
          Add another StringList
 void addAll(StringList items, java.lang.String prefix)
          Add another StringList with a prefix in front of each item
 StringList getDistinct()
          Get StringList without duplicates.
 int getDistinctCount()
          Get count of distinct strings.
 java.lang.String getFirstString()
          Get first string without casting.
 java.lang.String getLastString()
          Get last string without casting.
 java.lang.String getLeastFrequent()
          Find least frequent string in list.
 java.lang.String getMostFrequent()
          Find most frequent string in list.
 java.lang.String getString(int index)
          Get a string by index without casting.
 int similarIndexOf(java.lang.String value)
          Get index of string similar to value.
 java.lang.String toString()
          Get string representation, items seperated with space.
 java.lang.String toString(java.lang.String separator)
          Get string representation, items seperated with given separator.
 java.lang.String[] toStringArray()
          Return string list as array
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, peek, poll, remove, remove, remove, removeFirst, removeLast, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

StringList

public StringList()
Standard constructor without arguments.


StringList

public StringList(StringList list)

StringList

public StringList(java.util.Collection collection)
Constructor with a collection of objects. Each object is converted to a string with toString()

Parameters:
v - Collection of objects.

StringList

public StringList(java.lang.String s)
Constructor with a single string. List is initialized with that string.

Parameters:
s - A string.
Method Detail

addAll

public void addAll(StringList items)
Add another StringList

Parameters:
items - Items to add

addAll

public void addAll(StringList items,
                   java.lang.String prefix)
Add another StringList with a prefix in front of each item

Parameters:
items - Items to add
prefix - prefix

getString

public java.lang.String getString(int index)
Get a string by index without casting.

Parameters:
index - Index of string in list
Returns:
String at this index

getFirstString

public java.lang.String getFirstString()
Get first string without casting.

Returns:
First string.

getLastString

public java.lang.String getLastString()
Get last string without casting.

Returns:
Last string.

toString

public java.lang.String toString(java.lang.String separator)
Get string representation, items seperated with given separator.

Parameters:
separator - Charachter to seperate items.
Returns:
Concatenated string of items.

toString

public java.lang.String toString()
Get string representation, items seperated with space.

Overrides:
toString in class java.util.AbstractCollection
Returns:
Concatenated string of items separated with space.

toStringArray

public java.lang.String[] toStringArray()
Return string list as array

Returns:
string array

getMostFrequent

public java.lang.String getMostFrequent()
Find most frequent string in list.

Returns:
Returns most frequent string.

getLeastFrequent

public java.lang.String getLeastFrequent()
Find least frequent string in list.

Returns:
Returns least frequent string.

getDistinct

public StringList getDistinct()
Get StringList without duplicates.

Returns:
Returns list without any duplicates.

getDistinctCount

public int getDistinctCount()
Get count of distinct strings.

Returns:
Returns size of getDistinct()

similarIndexOf

public int similarIndexOf(java.lang.String value)
Get index of string similar to value.

Returns:
Index of string found.


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.