forked from eclipse/eclipse-collections
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse#436 from mlsharrock/master
Add multiReader factories to Sets eclipse#338
- Loading branch information
Showing
3 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
.../src/main/java/org/eclipse/collections/impl/set/mutable/MultiReaderMutableSetFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) 2018 Goldman Sachs. | ||
* 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.set.mutable; | ||
|
||
import org.eclipse.collections.api.factory.set.MutableSetFactory; | ||
import org.eclipse.collections.api.set.MutableSet; | ||
|
||
public enum MultiReaderMutableSetFactory implements MutableSetFactory | ||
{ | ||
INSTANCE; | ||
|
||
@Override | ||
public <T> MutableSet<T> empty() | ||
{ | ||
return MultiReaderUnifiedSet.newSet(); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> of() | ||
{ | ||
return this.empty(); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> with() | ||
{ | ||
return this.empty(); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> of(T... items) | ||
{ | ||
return this.with(items); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> with(T... items) | ||
{ | ||
return MultiReaderUnifiedSet.newSetWith(items); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> ofInitialCapacity(int capacity) | ||
{ | ||
return this.withInitialCapacity(capacity); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> withInitialCapacity(int capacity) | ||
{ | ||
if (capacity < 0) | ||
{ | ||
throw new IllegalArgumentException("initial capacity cannot be less than 0"); | ||
} | ||
|
||
return MultiReaderUnifiedSet.newSet(capacity); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> ofAll(Iterable<? extends T> iterable) | ||
{ | ||
return this.withAll(iterable); | ||
} | ||
|
||
@Override | ||
public <T> MutableSet<T> withAll(Iterable<? extends T> iterable) | ||
{ | ||
return MultiReaderUnifiedSet.newSet((Iterable<T>) iterable); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters