example
Class TableExample
java.lang.Object
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TableExample
public TableExample()
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 valuevalue - 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