Example usage for java.util Collections newSetFromMap

List of usage examples for java.util Collections newSetFromMap

Introduction

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

Prototype

public static <E> Set<E> newSetFromMap(Map<E, Boolean> map) 

Source Link

Document

Returns a set backed by the specified map.

Usage

From source file:com.example.android.supportv4.media.model.MusicProvider.java

public MusicProvider() {
    mMusicListByGenre = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();
    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
    mMusicGenres = new ArrayList<>();
}

From source file:com.bayapps.android.robophish.model.MusicProvider.java

public MusicProvider(MusicProviderSource source) {
    mSource = source;// w ww.j  a  v a  2s .  co m
    mYears = new ArrayList<YearData>();
    mShowsInYearYear = new ConcurrentHashMap<>();
    mTracksInShow = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();

    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());

}

From source file:com.example.hp.smartstor.CloudMusicManager.uamp.model.MusicProvider.java

public MusicProvider(com.example.hp.smartstor.CloudMusicManager.uamp.model.MusicProviderSource source) {
    mSource = source;/*from ww w.j  a v a  2 s  . c  o  m*/
    mMusicListByGenre = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();
    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
}

From source file:mondrian.util.UtilCompatibleJdk16.java

@Override
public <T> Set<T> newIdentityHashSet() {
    return Collections.newSetFromMap(new IdentityHashMap<T, Boolean>());
}

From source file:de.rwth_aachen.comsys.audiosync.model.MusicProvider.java

public MusicProvider() {
    mMusicListByGenre = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();
    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());

    createLocal("bis_spaeter.mp3");
    createLocal("background.mp3");
    createLocal("mandelsson.mp3");
    createLocal("metronom.mp3");
}

From source file:com.torrenttunes.android.model.MusicProvider.java

public MusicProvider() {
    mMusicListByArtist = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();
    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
}

From source file:robert843.o2.pl.player.model.MusicProvider.java

public MusicProvider(Context context) {
    mContext = context;/*from w ww  .ja  v a2 s  . c  o  m*/
    mMusicListByGenre = new ConcurrentHashMap<>();
    mMusicListById = new ConcurrentHashMap<>();
    mFavoriteTracks = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
}

From source file:org.biopax.validator.api.beans.Validation.java

/** 
 * Default Constructor (this is mainly for OXM)
 * @param idCalculator a strategy object to get a domain-specific identifier (for reporting)
 *//*from  ww  w . j a va2  s . c  om*/
public Validation(Identifier idCalculator) {
    this.error = new TreeSet<ErrorType>();
    this.objects = Collections.newSetFromMap(new ConcurrentHashMap<Object, Boolean>());
    this.description = "unknown";
    this.comment = new HashSet<String>();
    this.fix = false;
    this.threshold = Behavior.WARNING;
    this.maxErrors = Integer.MAX_VALUE;
    this.profile = null;
    this.properties = new Properties();
    this.idCalc = (idCalculator != null) ? idCalculator : new Identifier() {
        // fall-back Identifier strategy implementation that uses toString
        public String identify(Object obj) {
            return String.valueOf(obj);
        }
    };
}

From source file:com.hack23.cia.service.data.impl.util.LoadHelper.java

/**
 * Recursive initliaze./*from  w w  w.j a  v a  2  s.  co  m*/
 *
 * @param <T>
 *            the generic type
 * @param obj
 *            the obj
 * @return the t
 */
public static <T> T recursiveInitialize(final T obj) {
    if (obj != null) {

        final Set<Object> dejaVu = Collections.newSetFromMap(new IdentityHashMap<Object, Boolean>());
        try {
            recursiveInitialize(obj, dejaVu);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
            handleReflectionException(e);
        }
    }
    return obj;
}

From source file:pcgen.cdom.helper.BridgeListener.java

private ImmutablePair<Set<Object>, Set<Object>> processIdentityDeltas(Object[] oldValue, Object[] newValue) {
    Set<Object> toAdd = Collections.newSetFromMap(new IdentityHashMap<>());
    Collections.addAll(toAdd, newValue);
    Set<Object> toRemove = Collections.newSetFromMap(new IdentityHashMap<>());
    Collections.addAll(toRemove, oldValue);
    if ((oldValue.length != 0) && (newValue.length != 0)) {
        //Note order sensitivity
        toRemove.removeAll(toAdd);//from  w w w  .j a va  2  s.  c  om
        Collections.addAll(toAdd, oldValue);
    }
    return new ImmutablePair<>(toRemove, toAdd);
}