VCollections.src.org.violetlib.collections.impl.Impl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vcollections Show documentation
Show all versions of vcollections Show documentation
Java Immutable Collections
The newest version!
/*
* Copyright (c) 2023 Alan Snyder.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the license agreement. For details see
* accompanying license terms.
*/
package org.violetlib.collections.impl;
import java.util.Comparator;
import java.util.Map;
import org.violetlib.collections.*;
import org.jetbrains.annotations.*;
import org.violetlib.annotations.NoInstances;
/**
*/
public final @NoInstances class Impl
{
private Impl()
{
throw new AssertionError("Impl may not be instantiated");
}
public static @NotNull IList getEmptyList()
{
return EmptyListImpl.empty();
}
public static @NotNull IList getIndexableEmptyList()
{
return SimpleList.EMPTY;
}
public static @NotNull ICollection concatenate(@NotNull IList extends ICollection> sources)
{
return ICollectionSequence.create(sources);
}
public static @NotNull ISet getEmptySet()
{
return SimpleSet.empty();
}
public static @NotNull ISet createSet(@NotNull Iterable extends V> values)
throws IllegalArgumentException
{
return SimpleSet.collect(values);
}
public static @NotNull IIterator concatenateIterators(@NotNull IList extends IIterator> sources)
{
return SimpleCompositeIterator.create(IList.cast(sources));
}
@SafeVarargs
public static @NotNull ISet setOf(@NotNull V... elements)
throws IllegalArgumentException
{
return SimpleSet.create(elements);
}
public static @NotNull SetBuilder getSetBuilder()
{
return SetBuilderImpl.create();
}
public static @NotNull SetBuilder getOrderedSetBuilder()
{
return OrderedSetBuilderImpl.create();
}
public static @NotNull Comparator