comboreadmap.java

来自「欢迎使用 FastJsp 开发框架! 编译说明: * 若要生成Api J」· Java 代码 · 共 78 行

JAVA
78
字号
package com.onetsoft.fastjsp;


import java.util.Set;
import java.util.Map;
import java.util.Collection;

class ComboReadMap implements Map {
    Map[] a = null;
    int len=0;
    public ComboReadMap(Map[] a) {
        this.a = a;
        this.len=a.length;
    }

    public int size() {
        int count = 0;
        for (int i = 0; i < len; i++) {
            count += a[i].size();
        }
        return count;
    }

    public void clear() {
        throw new UnsupportedOperationException();
    }

    public boolean isEmpty() {
        return size() == 0;
    }

    public boolean containsKey(Object key) {
        for (int i = 0; i <len; i++) {
            if (a[i].containsKey(key)) return true;
        }
        return false;
    }

    public boolean containsValue(Object value) {
        for (int i = 0; i < len; i++) {
            if (a[i].containsValue(value)) return true;
        }
        return false;
    }

    public Object get(Object key) { 
        for (int i = 0; i < len; i++) {
            Object o = a[i].get(key);
            if (o != null) return o;
        }
        return null;
    }

    public Collection values() {
        throw new UnsupportedOperationException();
    }

    public void putAll(Map t) {
        throw new UnsupportedOperationException();
    }

    public Set entrySet() {
        throw new UnsupportedOperationException();
    }

    public Set keySet() {
        throw new UnsupportedOperationException();
    }

    public Object remove(Object key) {
        throw new UnsupportedOperationException();
    }

    public Object put(Object key, Object value) {
        throw new UnsupportedOperationException();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?