Skip to content

Commit

Permalink
Merge pull request #236 from JarvisCraft/1.0.0-rc.5
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvisCraft committed Aug 27, 2021
2 parents 6dd316b + f218977 commit 41e5685
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@

/**
* Wrapper of a reference.
*
* @param <T> type of reference
*/
public interface ReferenceWrapper<T> {

/**
* Creates new simple reference wrapper.
*
* @param value initial reference of int wrapper
* @param <T> type of reference
* @return created reference wrapper
*/
static <T> ReferenceWrapper<T> create(final T value) {
Expand All @@ -26,6 +29,7 @@ static <T> ReferenceWrapper<T> create(final T value) {
/**
* Creates new simple reference wrapper with initial value set to {@code null}.
*
* @param <T> type of reference
* @return created reference wrapper
*/
static <T> ReferenceWrapper<T> create() {
Expand All @@ -36,6 +40,7 @@ static <T> ReferenceWrapper<T> create() {
* Creates new atomic reference wrapper.
*
* @param value initial value of reference wrapper
* @param <T> type of reference
* @return created reference wrapper
*/
static <T> ReferenceWrapper<T> createAtomic(final T value) {
Expand All @@ -45,6 +50,7 @@ static <T> ReferenceWrapper<T> createAtomic(final T value) {
/**
* Creates new atomic reference wrapper with initial value set to {@code null}.
*
* @param <T> type of reference
* @return created reference wrapper
*/
static <T> ReferenceWrapper<T> createAtomic() {
Expand Down Expand Up @@ -109,6 +115,8 @@ static <T> ReferenceWrapper<T> createAtomic() {

/**
* {@link ReferenceWrapper} implementation based on primitive reference.
*
* @param <T> type of reference
*/
@ToString
@EqualsAndHashCode
Expand Down Expand Up @@ -166,6 +174,8 @@ public T accumulateAndGet(final T updateValue, final @NonNull BinaryOperator<T>

/**
* {@link ReferenceWrapper} implementation based on {@link AtomicReference}.
*
* @param <T> type of reference
*/
@ToString
@EqualsAndHashCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class BlackHole {
/**
* Consumes the provided value without any visible side effects.
* This may be used for scenarios when an arbitrary expression has to be treated as a statement,
* for example{@code String.class}</pre> is an expression but not a statement
* but <pre>{@code BlackHole.consume(String.class)}</pre> is.
* for example{@code String.class} is an expression but not a statement
* but {@code BlackHole.consume(String.class)} is.
*
* @param value consumed value
* @param <T> type of consumed value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* {@link Collector Collectors} for use with enums with automatic type inference.
* This delegates its logic to the corresponding methods of {@link AutoEnumCollectors}
* This delegates its logic to the corresponding methods of {@link EnumCollectors}
* but infers enum types via {@link TypeHints#resolve(Object[]) type hints}
* this leads to insignificant overhead due to empty-array allocation cost
* thus it is recommended to provide types explicitly in critical sections.
Expand All @@ -29,7 +29,9 @@ public class AutoEnumCollectors {
* @param valueMapper mapping function used to convert the elements into values
* @param merger function used to handle duplicate values
* @param typeHint array used for enum-type discovery
* @param <T> type of the input elements
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
@SafeVarargs
Expand All @@ -49,6 +51,7 @@ public class AutoEnumCollectors {
* @param merger function used to handle duplicate values
* @param typeHint array used for enum-type discovery
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
@SafeVarargs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ public class EnumCollectors {
/**
* Returns a {@link Collector} that accumulates the input elements into a new enum-{@link Map}.
*
* @param <E> type of the enum
* @param type type object of the enum
* @param keyMapper mapping function used to convert the elements into enum-keys
* @param valueMapper mapping function used to convert the elements into values
* @param merger function used to handle duplicate values
* @param <T> type of the input elements
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
public <T, E extends Enum<E>, V> @NotNull Collector<T, ?, @NotNull Map<E, V>> toEnumMap(
Expand All @@ -54,7 +56,9 @@ public class EnumCollectors {
* @param valueMapper mapping function used to convert the elements into values
* @param merger function used to handle duplicate values
* @param typeHint array used for enum-type discovery
* @param <T> type of the input elements
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
@SafeVarargs
Expand All @@ -70,10 +74,12 @@ public class EnumCollectors {
/**
* Returns a {@link Collector} that accumulates the input elements into a new enum-{@link Map}.
*
* @param <E> type of the enum
* @param type type object of the enum
* @param keyMapper mapping function used to convert the elements into enum-keys
* @param valueMapper mapping function used to convert the elements into values
* @param <T> type of the input elements
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
public <T, E extends Enum<E>, V> @NotNull Collector<T, ?, @NotNull Map<E, V>> toEnumMap(
Expand All @@ -87,9 +93,10 @@ public class EnumCollectors {
/**
* Returns a {@link Collector} that accumulates the input elements into a new enum-{@link Map}.
*
* @param <E> type of the enum
* @param type type object of the enum
* @param valueMapper mapping function used to convert the elements into values
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
public <E extends Enum<E>, V> @NotNull Collector<E, ?, @NotNull Map<E, V>> toEnumMap(
Expand All @@ -102,10 +109,11 @@ public class EnumCollectors {
/**
* Returns a {@link Collector} that accumulates the input elements into a new enum-{@link Map}.
*
* @param <E> type of the enum
* @param type type object of the enum
* @param valueMapper mapping function used to convert the elements into values
* @param merger function used to handle duplicate values
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
public <E extends Enum<E>, V> @NotNull Collector<E, ?, @NotNull Map<E, V>> toEnumMap(
Expand All @@ -123,6 +131,7 @@ public class EnumCollectors {
* @param merger function used to handle duplicate values
* @param typeHint array used for enum-type discovery
* @param <E> type of the enum
* @param <V> type of map values
* @return a collector collecting al its elements into an enum-map
*/
@SafeVarargs
Expand Down

0 comments on commit 41e5685

Please sign in to comment.