/*
* Copyright (c) 2017 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.impl.factory;
import java.util.List;
import org.eclipse.collections.api.factory.list.FixedSizeListFactory;
import org.eclipse.collections.api.factory.list.ImmutableListFactory;
import org.eclipse.collections.api.factory.list.MutableListFactory;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.list.fixed.FixedSizeListFactoryImpl;
import org.eclipse.collections.impl.list.immutable.ImmutableListFactoryImpl;
import org.eclipse.collections.impl.list.mutable.ListAdapter;
import org.eclipse.collections.impl.list.mutable.MultiReaderMutableListFactory;
import org.eclipse.collections.impl.list.mutable.MutableListFactoryImpl;
This class should be used to create instances of MutableList, ImmutableList and FixedSizeList
Mutable Examples:
MutableList<String> emptyList = Lists.mutable.empty();
MutableList<String> listWith = Lists.mutable.with("a", "b", "c");
MutableList<String> listOf = Lists.mutable.of("a", "b", "c");
Immutable Examples:
ImmutableList<String> emptyList = Lists.immutable.empty();
ImmutableList<String> listWith = Lists.immutable.with("a", "b", "c");
ImmutableList<String> listOf = Lists.immutable.of("a", "b", "c");
FixedSize Examples:
FixedSizeList<String> emptyList = Lists.fixedSize.empty();
FixedSizeList<String> listWith = Lists.fixedSize.with("a", "b", "c");
FixedSizeList<String> listOf = Lists.fixedSize.of("a", "b", "c");
/**
* This class should be used to create instances of MutableList, ImmutableList and FixedSizeList
* <p>
* Mutable Examples:
*
* <pre>
* MutableList<String> emptyList = Lists.mutable.empty();
* MutableList<String> listWith = Lists.mutable.with("a", "b", "c");
* MutableList<String> listOf = Lists.mutable.of("a", "b", "c");
* </pre>
*
* Immutable Examples:
*
* <pre>
* ImmutableList<String> emptyList = Lists.immutable.empty();
* ImmutableList<String> listWith = Lists.immutable.with("a", "b", "c");
* ImmutableList<String> listOf = Lists.immutable.of("a", "b", "c");
* </pre>
*
* FixedSize Examples:
*
* <pre>
* FixedSizeList<String> emptyList = Lists.fixedSize.empty();
* FixedSizeList<String> listWith = Lists.fixedSize.with("a", "b", "c");
* FixedSizeList<String> listOf = Lists.fixedSize.of("a", "b", "c");
* </pre>
*/
@SuppressWarnings("ConstantNamingConvention")
public final class Lists
{
public static final ImmutableListFactory immutable = ImmutableListFactoryImpl.INSTANCE;
public static final MutableListFactory mutable = MutableListFactoryImpl.INSTANCE;
public static final FixedSizeListFactory fixedSize = FixedSizeListFactoryImpl.INSTANCE;
public static final MutableListFactory multiReader = MultiReaderMutableListFactory.INSTANCE;
private Lists()
{
throw new AssertionError("Suppress default constructor for noninstantiability");
}
Since: 9.0.
/**
* @since 9.0.
*/
public static <T> MutableList<T> adapt(List<T> list)
{
return ListAdapter.adapt(list);
}
}