package com.yihu.hos.standard.util;

import java.util.*;

/**
 * Created by Administrator on 2016/7/13.
 */
public class LikeHashMap<K, V> extends HashMap<K, V> {
    public V get(String key, boolean like) {
        List<V> list = null;
        if (like) {
            list = new ArrayList<V>();
            K[] a = null;
            Set<K> set = this.keySet();
            a = (K[])set.toArray();
            Arrays.sort(a, null);

            for (int i = 0; i < a.length; i++) {
                if (a[i].toString().indexOf(key) == -1) {
                    continue;
                } else {
                   return this.get(a[i]);
                }
            }
        }
        return null;
    }
}
