Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mindbright.ssh2
Class SSH2ListUtil

    java.lang.Object
      com.mindbright.ssh2.SSH2ListUtil

public final class SSH2ListUtil
extends java.lang.Object

Util class for manipulating commaseparated lists.

Constructor Summary
`SSH2ListUtil()`

Method Summary
`static java.lang.String[]` | `arrayFromList(java.lang.String list)` Convert a list expressed as a commaseparated string to an array.
`static java.lang.String[]` | `arrayFromList(java.lang.String list, java.lang.String delim)` Convert a list expressed as a delimited string to an array.
`static java.lang.String` | `chooseFromList(java.lang.String clientList, java.lang.String serverList)` Select the first entry in the clientList which also exists in the server List.
`static java.lang.String` | `getFirstInList(java.lang.String list)` Get the first element of the list.
`static boolean` | `isInList(java.lang.String list, java.lang.String element)` Checks if the given element is mentioned in the list.
`static boolean` | `isPrefixInList(java.lang.String list, java.lang.String prefix)` Checks if the any element in the list starts with the given prefix.
`static java.lang.String` | `listFromArray(java.lang.String[] arr)` Convert an array of strings into a commaseparated string.
`static java.lang.String` | `removeAllFromList(java.lang.String list, java.lang.String element)` Remove all instances of a specific element from list.
`static java.lang.String` | `removeAllPrefixFromList(java.lang.String list, java.lang.String prefix)` Remove all elements which starts with the given string from list.
`static java.lang.String` | `removeFirstFromList(java.lang.String list, java.lang.String element)` Remove the first instance of the given element from the list.
`static java.lang.String` | `sortList(java.lang.String list)` Sort the list alphabetically.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SSH2ListUtil

    public SSH2ListUtil()

Method Detail

### chooseFromList

    public static java.lang.String chooseFromList(java.lang.String clientList,
                                                  java.lang.String serverList)

  Select the first entry in the clientList which also exists in the server List.

  Parameters:
    `clientList` - List of keys to look for.
    `serverList` - List to look in.
  Returns:
    The new list.

### removeAllFromList

    public static java.lang.String removeAllFromList(java.lang.String list,
                                                     java.lang.String element)

  Remove all instances of a specific element from list.

  Parameters:
    `list` - List to remove elements from.
    `element` - Element to remove.
  Returns:
    The new list.

### removeAllPrefixFromList

    public static java.lang.String removeAllPrefixFromList(java.lang.String list,
                                                           java.lang.String prefix)

  Remove all elements which starts with the given string from list.

  Parameters:
    `list` - List to remove elements from.
    `prefix` - Prefix of elements to remove.
  Returns:
    The new list.

### removeFirstFromList

    public static java.lang.String removeFirstFromList(java.lang.String list,
                                                       java.lang.String element)

  Remove the first instance of the given element from the list.

  Parameters:
    `list` - List to remove element from.
    `element` - Element to remove.
  Returns:
    The new list.

### getFirstInList

    public static java.lang.String getFirstInList(java.lang.String list)

  Get the first element of the list.

  Parameters:
    `list` - The list.
  Returns:
    The first element or `null` if the list is empty.

### isInList

    public static boolean isInList(java.lang.String list,
                                   java.lang.String element)

  Checks if the given element is mentioned in the list.

  Parameters:
    `list` - List to look in.
    `element` - Element to look for.
  Returns:
    True if the element is found.

### isPrefixInList

    public static boolean isPrefixInList(java.lang.String list,
                                         java.lang.String prefix)

  Checks if the any element in the list starts with the given prefix.

  Parameters:
    `list` - List to look in.
    `prefix` - Prefix to look for.
  Returns:
    True if any matching element is found.

### sortList

    public static java.lang.String sortList(java.lang.String list)

  Sort the list alphabetically.

  Parameters:
    `list` - List to sort.
  Returns:
    A sorted list.

### arrayFromList

    public static java.lang.String[] arrayFromList(java.lang.String list)

  Convert a list expressed as a commaseparated string to an array.

  Parameters:
    `list` - List to split.
  Returns:
    Resulting array.

### arrayFromList

    public static java.lang.String[] arrayFromList(java.lang.String list,
                                                   java.lang.String delim)

  Convert a list expressed as a delimited string to an array.

  Parameters:
    `list` - List to split.
    `delim` - Delimiter.
  Returns:
    Resulting array.

### listFromArray

    public static java.lang.String listFromArray(java.lang.String[] arr)

  Convert an array of strings into a commaseparated string.

  Parameters:
    `arr` - Array to convert.
  Returns:
    The resulting string.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD