Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Map {
- public static class Pair {
- private Object key, value;
- public Pair(Object key, Object value) {
- this.key = key;
- this.value = value;
- }
- }
- Pair[] pairs;
- public Map(){
- pairs = new Pair[2];
- }
- public Map(int size){
- pairs = new Pair[size];
- }
- public void put(Object key, Object value) {
- for (int i = 0; i<pairs.length; i++) {
- if (key == pairs[i].key) {
- pairs[i].value = value;
- }
- }
- }
- public Object get(Object key) {
- for (int i=0; i<pairs.length; i++) {
- if (key == pairs[i].key) {
- return pairs[i].value;
- }
- }
- return null;
- }
- public void remove(Object key) {
- }
- public Object[] keys (){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement