Implemented forEachEntry() and forEachEntryWhile()

This commit is contained in:
leventov
2015-01-20 01:00:38 +07:00
parent f53a93275c
commit 06b326ab05
34 changed files with 575 additions and 239 deletions
@@ -0,0 +1,38 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.hash.function;
/**
* Represents an operation that accepts a single input argument and returns no
* result. Unlike most other functional interfaces, {@code Consumer} is expected
* to operate via side-effects.
*
* <p>This is a functional interface whose functional method is {@link #accept(Object)}.
*
* <p>This is a copy of Java 8's {@code java.util.function.Consumer} interface.
*
* @param <T> the type of the input to the operation
*/
public interface Consumer<T> {
/**
* Performs this operation on the given argument.
*
* @param t the input argument
*/
void accept(T t);
}
@@ -0,0 +1,26 @@
package net.openhft.chronicle.hash.function;
import java.io.Serializable;
/**
* Represents a function that accepts one argument and produces a result.
*
* <p>This is a functional interface whose functional method is {@link #apply(Object)}.
*
* <p>This is a copy of Java 8's {@code java.util.function.Function} interface.
*
* @param <T> the type of the input to the function
* @param <R> the type of the result of the function
*/
public interface Function<T, R> extends Serializable {
/**
* Applies this function to the given argument.
*
* @param t the function argument
* @return the function result
*/
R apply(T t);
}
@@ -0,0 +1,39 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.chronicle.hash.function;
/**
* Represents a predicate (boolean-valued function) of one argument.
*
* <p>This is a functional interface whose functional method is {@link #test(Object)}.
*
* <p>This is a copy of Java 8's {@code java.util.function.Predicate} interface.
*
* @param <T> the type of the input to the predicate
*/
public interface Predicate<T> {
/**
* Evaluates this predicate on the given argument.
*
* @param t the input argument
* @return {@code true} if the input argument matches the predicate,
* otherwise {@code false}
*/
boolean test(T t);
}
@@ -0,0 +1,21 @@
/*
* Copyright 2014 Higher Frequency Trading http://www.higherfrequencytrading.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Copies of some interfaces from Java 8 used by Chronicle Map project
* for Java 7+.
*/
package net.openhft.chronicle.hash.function;