public class OrderedMap
extends java.lang.Object
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object[][] |
map
mapping key to value
|
protected int |
nK
the number of keys in the map
|
Constructor and Description |
---|
OrderedMap()
constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object o)
returns
true if the Object is a key in the Map,
false otherwise |
boolean |
containsValue(java.lang.Object o)
returns
true if the Object is a value in the Map,
false otherwise |
java.lang.Object |
get(java.lang.Object key)
get the value of the key
|
java.lang.Object[] |
getKeys()
get the keys
|
java.lang.Object |
getValue(int i)
get the
i -th value |
java.lang.Object[] |
getValues()
get the values
|
private void |
increaseCapacity()
increases the capacity of the mapping
|
static void |
main(java.lang.String[] args) |
void |
put(java.lang.Object key,
java.lang.Object value)
puts a pair (key,value) in the map
|
java.lang.Object |
setValue(int i,
java.lang.Object value)
sets the value of the
i -th entry |
int |
size()
returns the number of keys in this Map
|
protected java.lang.Object[][] map
protected int nK
public void put(java.lang.Object key, java.lang.Object value)
key
- key of the pairvalue
- value of the pairprivate void increaseCapacity()
public boolean containsKey(java.lang.Object o)
true
if the Object is a key in the Map,
false
otherwiseo
- Object to be compared against the keystrue
if Object is already in Map,
false
otherwisepublic boolean containsValue(java.lang.Object o)
true
if the Object is a value in the Map,
false
otherwiseo
- Object to be compared against the valuestrue
if Object is already in Map,
false
otherwisepublic java.lang.Object[] getKeys()
public java.lang.Object[] getValues()
public java.lang.Object getValue(int i)
i
-th valuei
-th valuepublic java.lang.Object get(java.lang.Object key)
key
- the key for which the value will be returnedpublic java.lang.Object setValue(int i, java.lang.Object value)
i
-th entryi
- the number of the valuei
-th entrypublic int size()
public static void main(java.lang.String[] args)