Java 8 LinkedHashSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 LinkedHashSet class.

This code example shows how to use the following methods:add, iterator, size
 
      return new Gson().fromJson(serialized, type);
    } 
 
    public static void putRecentlyUsed(Context context, String asset) {
      LinkedHashSet<String> recentlyUsed = new LinkedHashSet<String>(getRecentlyUsed(context));
      recentlyUsed.add(asset);
 
      if (recentlyUsed.size() > 10) {
        Iterator<String> iterator = recentlyUsed.iterator();
        iterator.next();
        iterator.remove();
      } 
 
      String serialized = new Gson().toJson(recentlyUsed);
      PreferenceManager.getDefaultSharedPreferences(context)
                       .edit()
                       .putString(EMOJI_LRU_PREFERENCE, serialized)
                       .commit();
    } 
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
	bhash.put(bbar, bcar);
	bhash.put(bcar, bbar);
	jedis.hmset(bfoo, bhash);
 
	Set<byte[]> bkeys = jedis.hkeys(bfoo);
	Set<byte[]> bexpected = new LinkedHashSet<byte[]>();
	bexpected.add(bbar);
	bexpected.add(bcar);
	assertEquals(bexpected, bkeys);
    } 
 
    @Test 
    public void hvals() { 
	Map<String, String> hash = new LinkedHashMap<String, String>();
	hash.put("bar", "car");
	hash.put("car", "bar");
	jedis.hmset("foo", hash);
 
	List<String> vals = jedis.hvals("foo");
	assertEquals(2, vals.size());
9
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
 
    Object snapshotValue = snapshot.get(key);
    if (snapshotValue == null) {
      final OIdentifiable storedValue = indexEngine.get(key);
 
      final Set<OIdentifiable> values = new LinkedHashSet<OIdentifiable>();
 
      if (storedValue != null)
        values.add(storedValue.getIdentity());
 
      values.add(value.getIdentity());
 
      snapshot.put(key, values);
    } else if (snapshotValue instanceof Set) {
      final Set<OIdentifiable> values = (Set<OIdentifiable>) snapshotValue;
 
      values.add(value.getIdentity());
    } else { 
      final Set<OIdentifiable> values = new LinkedHashSet<OIdentifiable>();
 
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
        jedis.zadd("foo", 1d, "a"); 
        jedis.zadd("foo", 2d, "b"); 
 
        long status = jedis.zrem("foo", "a");
 
        Set<String> expected = new LinkedHashSet<String>();
        expected.add("b");
 
        assertEquals(1, status);
        assertEquals(expected, jedis.zrange("foo", 0, 100));
 
        status = jedis.zrem("foo", "bar");
 
        assertEquals(0, status);
 
        // Binary 
        jedis.zadd(bfoo, 1d, ba);
        jedis.zadd(bfoo, 2d, bb);
 
        long bstatus = jedis.zrem(bfoo, ba);
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    private final Set<String> scannedResourceClasses = new LinkedHashSet<String>();
    private final Set<String> scannedProviderClasses = new LinkedHashSet<String>();
    private List<Class<? extends Application>> scannedApplicationClasses = new ArrayList<>();
    private boolean bootClasses;
    private boolean unwrappedExceptionsParameterSet;
    private final Set<String> scannedJndiComponentResources = new LinkedHashSet<String>();
 
    /** 
     * Merges a list of additional JAX-RS deployment data with this lot of deployment data. 
     * 
     * @param deploymentData 
     */ 
    public void merge(final List<ResteasyDeploymentData> deploymentData) throws DeploymentUnitProcessingException {
        for (ResteasyDeploymentData data : deploymentData) {
            scannedApplicationClasses.addAll(data.getScannedApplicationClasses());
            if (scanResources) {
                scannedResourceClasses.addAll(data.getScannedResourceClasses());
                scannedJndiComponentResources.addAll(data.getScannedJndiComponentResources());
            } 
            if (scanProviders) {
8
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return matching(Specs.<T>convertClosureToSpec(spec));
    } 
 
    @Override 
    public Set<T> findAll(Closure cl) {
        return findAll(cl, new LinkedHashSet<T>());
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @see org.springframework.context.support.AbstractApplicationContext#prepareRefresh() 
 */ 
@SuppressWarnings("serial") 
public class MissingRequiredPropertiesException extends IllegalStateException {
 
	private final Set<String> missingRequiredProperties = new LinkedHashSet<String>();
 
	/** 
	 * Return the set of properties marked as required but not present 
	 * upon validation. 
	 * @see ConfigurablePropertyResolver#setRequiredProperties(String...) 
	 * @see ConfigurablePropertyResolver#validateRequiredProperties() 
	 */ 
	public Set<String> getMissingRequiredProperties() {
		return missingRequiredProperties;
	} 
 
	void addMissingRequiredProperty(String key) {
		missingRequiredProperties.add(key);
	} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        assert readOnlyConstraint != null : "invalid cast";
        return readOnlyConstraint;
    } 
 
    private static class HostsHolder { 
        private volatile Set<String> specific = new LinkedHashSet<String>();
        private HostsHolder() { 
            // no-op 
        } 
        private HostsHolder(Collection<String> hosts) {
            this.specific.addAll(hosts);
        } 
    } 
 
    private static class Factory extends AbstractConstraintFactory implements ScopingConstraintFactory { 
 
        @Override 
        public Constraint getStandardUserConstraint(StandardRole role, Action.ActionEffect actionEffect) {
            return GLOBAL_USER;
        } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return matching(Specs.<T>convertClosureToSpec(spec));
    } 
 
    @Override 
    public Set<T> findAll(Closure cl) {
        return findAll(cl, new LinkedHashSet<T>());
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Juergen Hoeller 
 * @since 3.0 
 */ 
public class CompositeIterator<E> implements Iterator<E> {
 
	private final Set<Iterator<E>> iterators = new LinkedHashSet<Iterator<E>>();
 
	private boolean inUse = false;
 
 
	/** 
	 * Add given iterator to this composite. 
	 */ 
	public void add(Iterator<E> iterator) {
		Assert.state(!this.inUse, "You can no longer add iterators to a composite iterator that's already in use");
		if (this.iterators.contains(iterator)) {
			throw new IllegalArgumentException("You cannot add the same iterator twice");
		} 
		this.iterators.add(iterator);
	} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 LinkedHashSet Methods: