example
Class TableExample

java.lang.Object
  extended by example.TableExample

public class TableExample
extends Object

A class for showing how to test table-like objects. This idea can be used to fill different kind of data structures for test.

Author:
vesal

Constructor Summary
TableExample()
           
 
Method Summary
 void add(String key, String value)
          Add new value with key to the table.
 String get(String key)
          Finds the value for key.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableExample

public TableExample()
Method Detail

add

public void add(String key,
                String value)
Add new value with key to the table. Key is caseinsensitive.

Parameters:
key - key to use for value
value - value to add
Example:
 
 TableExample table = new TableExample();
 table.add("1","red");
 table.add("2","blue");
 table.add("b","blue");
 table.add("B","BLUE");
 
 table.get("1") === "red";
 table.get("b") === "BLUE";
 
 

get

public String get(String key)
Finds the value for key. Key is caseinsensitive.

Parameters:
key - for what the value is looked for
Returns:
the value for key, null if no value for key.
Example:
 
 TableExample table = new TableExample();
 table.add("$key","$value");
 
   $key  |  $value
  -------------------
    1    |   red
    2    |   blue
    3    |   green
    5    |   yellow
    Y    |   YELLOW
    y    |   yellow
    red  |   red
    RED  |   RED
    
  table.get($key) === $result;
  
   $key  |  $result
  -------------------
    "1"    |   "red"
    "2"    |   "blue"
    "4"    |   null  
    "5"    |   "yellow"
    "y"    |   "yellow"
    "Y"    |   "yellow"
    "red"  |   "RED"
    "RED"  |   "RED"
    ""     |   null  
    null   |   null  
 
 

main

public static void main(String[] args)
Parameters:
args - not used