org.eclipse.virgo.util.common.StaticSetProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.virgo.util.common Show documentation
Show all versions of org.eclipse.virgo.util.common Show documentation
Virgo from EclipseRT is a completely module-based Java application server
The newest version!
/*******************************************************************************
* Copyright (c) 2008, 2010 VMware Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* VMware Inc. - initial contribution
*******************************************************************************/
package org.eclipse.virgo.util.common;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/**
* An implementation of {@link SetProvider} that takes a static list of elements and returns them for every request for
* a set.
*
*
* Concurrent Semantics
*
* Threadsafe
*
* @param type of elements of set
*/
public class StaticSetProvider implements SetProvider {
private final Set set;
public StaticSetProvider(T... items) {
Set set = new HashSet(items.length);
Collections.addAll(set, items);
this.set = Collections.unmodifiableSet(set);
}
public Set getSet() {
return set;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy