org.eclipse.collections.api.factory.Bags Maven / Gradle / Ivy
/*
* Copyright (c) 2018 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.api.factory;
import org.eclipse.collections.api.factory.bag.ImmutableBagFactory;
import org.eclipse.collections.api.factory.bag.MutableBagFactory;
/**
* This class should be used to create instances of MutableBag and ImmutableBag
*
* Mutable Examples:
*
*
* MutableBag<String> emptyBag = Bags.mutable.empty();
* MutableBag<String> bagWith = Bags.mutable.with("a", "b", "c");
* MutableBag<String> bagOf = Bags.mutable.of("a", "b", "c");
*
*
* Immutable Examples:
*
*
* ImmutableBag<String> emptyBag = Bags.immutable.empty();
* ImmutableBag<String> bagWith = Bags.immutable.with("a", "b", "c");
* ImmutableBag<String> bagOf = Bags.immutable.of("a", "b", "c");
*
*/
@SuppressWarnings("ConstantNamingConvention")
public final class Bags
{
public static final ImmutableBagFactory immutable = ServiceLoaderUtils.loadServiceClass(ImmutableBagFactory.class);
public static final MutableBagFactory mutable = ServiceLoaderUtils.loadServiceClass(MutableBagFactory.class);
private Bags()
{
throw new AssertionError("Suppress default constructor for noninstantiability");
}
}