Example usage for java.util HashSet HashSet

List of usage examples for java.util HashSet HashSet

Introduction

In this page you can find the example usage for java.util HashSet HashSet.

Prototype

public HashSet() 

Source Link

Document

Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).

Usage

From source file:Main.java

public static void removeFromFavorites(final Context context, long movieId) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    Set<String> set = sp.getStringSet(PREF_FAVORED_MOVIES, null);
    if (set == null)
        set = new HashSet<>();
    set.remove(String.valueOf(movieId));
    sp.edit().putStringSet(PREF_FAVORED_MOVIES, set).apply();
}

From source file:Main.java

public static <V> HashSet<V> getHashSet(final Map<?, ? extends V> map, final Object... keys) {
    final HashSet<V> result = new HashSet<V>();
    get(map, result, keys);//from w  w  w  . j a  va 2 s.  c o m
    return result;
}