Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static <K, V> Set<V> valueToTreeSet(Map<K, V> map) {
        if (isNotNull(map)) {
            Set<V> set = new TreeSet<>();
            for (V v : map.values()) {
                System.out.println(v.hashCode());
                System.out.println(set.contains(v));
                set.add(v);
            }
            return set;
        }
        return null;
    }

    public static boolean isNotNull(Object[] array) {
        return !isNull(array);
    }

    public static boolean isNotNull(Collection<?> con) {
        return !isNull(con);
    }

    public static boolean isNotNull(Map<?, ?> map) {
        return !isNull(map);
    }

    public static boolean isNull(Collection<?> con) {
        if (con == null || con.isEmpty()) {
            return true;
        }
        return false;
    }

    public static boolean isNull(Object[] array) {
        if (array == null || array.length == 0) {
            return true;
        }
        return false;
    }

    public static boolean isNull(Map<?, ?> map) {
        if (map == null || map.isEmpty()) {
            return true;
        }
        return false;
    }
}