From 72a564f10b57e7e931af4e3951f27c04ff471fa5 Mon Sep 17 00:00:00 2001 From: Davide Grohmann Date: Tue, 8 Dec 2015 17:30:59 +0100 Subject: [PATCH] Remove custom Operators --- .../org/neo4j/function/BinaryOperator.java | 31 ---------------- .../java/org/neo4j/function/Functions.java | 11 +----- .../neo4j/function/LongBinaryOperator.java | 37 ------------------- .../org/neo4j/function/LongUnaryOperator.java | 36 ------------------ .../org/neo4j/function/UnaryOperator.java | 31 ---------------- .../batchimport/input/csv/CsvInputTest.java | 36 ++---------------- 6 files changed, 6 insertions(+), 176 deletions(-) delete mode 100644 community/function/src/main/java/org/neo4j/function/BinaryOperator.java delete mode 100644 community/function/src/main/java/org/neo4j/function/LongBinaryOperator.java delete mode 100644 community/function/src/main/java/org/neo4j/function/LongUnaryOperator.java delete mode 100644 community/function/src/main/java/org/neo4j/function/UnaryOperator.java diff --git a/community/function/src/main/java/org/neo4j/function/BinaryOperator.java b/community/function/src/main/java/org/neo4j/function/BinaryOperator.java deleted file mode 100644 index 8127c0cfb3fec..0000000000000 --- a/community/function/src/main/java/org/neo4j/function/BinaryOperator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002-2015 "Neo Technology," - * Network Engine for Objects in Lund AB [http://neotechnology.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.function; - -/** - * Represents an operation on a single operand that produces a result of the same type as its operand. This is a specialization of {@link BiFunction} for the - * case where the operand and result are of the same type. - * - * @param the type of the operand and result of the operator - * @deprecated Usages will be replaced by corresponding {@code java.util.function} interface and classes in 3.0. - */ -public interface BinaryOperator extends BiFunction, ThrowingBinaryOperator -{ -} diff --git a/community/function/src/main/java/org/neo4j/function/Functions.java b/community/function/src/main/java/org/neo4j/function/Functions.java index c074043c019e9..c48c0b36d8015 100644 --- a/community/function/src/main/java/org/neo4j/function/Functions.java +++ b/community/function/src/main/java/org/neo4j/function/Functions.java @@ -87,17 +87,10 @@ public To apply( From from ) }; } - private static UnaryOperator IDENTITY = new UnaryOperator() - { - @Override - public Object apply( Object value ) - { - return value; - } - }; + private static Function IDENTITY = value -> value; @SuppressWarnings( "unchecked" ) - public static UnaryOperator identity() + public static Function identity() { return IDENTITY; } diff --git a/community/function/src/main/java/org/neo4j/function/LongBinaryOperator.java b/community/function/src/main/java/org/neo4j/function/LongBinaryOperator.java deleted file mode 100644 index 6e40c72885407..0000000000000 --- a/community/function/src/main/java/org/neo4j/function/LongBinaryOperator.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2002-2015 "Neo Technology," - * Network Engine for Objects in Lund AB [http://neotechnology.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.function; - -/** - * Represents an operation upon two long-valued operands and producing a long-valued result. This is the primitive type specialization of {@link BinaryOperator} - * for long. - * @deprecated Usages will be replaced by corresponding {@code java.util.function} interface and classes in 3.0. - */ -public interface LongBinaryOperator extends ThrowingLongBinaryOperator -{ - /** - * Applies this operator to the given operand. - * - * @param left the first operand - * @param right the second operand - * @return the operator result - */ - long applyAsLong( long left, long right ); -} diff --git a/community/function/src/main/java/org/neo4j/function/LongUnaryOperator.java b/community/function/src/main/java/org/neo4j/function/LongUnaryOperator.java deleted file mode 100644 index 052890bc4dee5..0000000000000 --- a/community/function/src/main/java/org/neo4j/function/LongUnaryOperator.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002-2015 "Neo Technology," - * Network Engine for Objects in Lund AB [http://neotechnology.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.function; - -/** - * Represents an operation on a single long-valued operand that produces a long-valued result. This is the primitive type specialization of {@link - * UnaryOperator} for long. - * @deprecated Usages will be replaced by corresponding {@code java.util.function} interface and classes in 3.0. - */ -public interface LongUnaryOperator extends ThrowingLongUnaryOperator -{ - /** - * Applies this operator to the given operand. - * - * @param operand the operand - * @return the operator result - */ - long applyAsLong( long operand ); -} diff --git a/community/function/src/main/java/org/neo4j/function/UnaryOperator.java b/community/function/src/main/java/org/neo4j/function/UnaryOperator.java deleted file mode 100644 index 502fe9f30de77..0000000000000 --- a/community/function/src/main/java/org/neo4j/function/UnaryOperator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2002-2015 "Neo Technology," - * Network Engine for Objects in Lund AB [http://neotechnology.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.function; - -/** - * Represents an operation on a single operand that produces a result of the same type as its operand. This is a specialization of @{link Function} for the case - * where the operand and result are of the same type. - * - * @param the type of the operand and result of the operator - * @deprecated Usages will be replaced by corresponding {@code java.util.function} interface and classes in 3.0. - */ -public interface UnaryOperator extends Function, ThrowingUnaryOperator -{ -} diff --git a/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/input/csv/CsvInputTest.java b/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/input/csv/CsvInputTest.java index 9bb9f8907a843..e53cfdebaab20 100644 --- a/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/input/csv/CsvInputTest.java +++ b/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/input/csv/CsvInputTest.java @@ -834,27 +834,13 @@ public char arrayDelimiter() private DataFactory given( final CharSeeker data ) { - return new DataFactory() - { - @Override - public Data create( Configuration config ) - { - return dataItem( data, Functions.identity() ); - } - }; + return config -> dataItem( data, Functions.identity() ); } private DataFactory data( final CharSeeker data, final Function decorator ) { - return new DataFactory() - { - @Override - public Data create( Configuration config ) - { - return dataItem( data, decorator ); - } - }; + return config -> dataItem( data, decorator ); } private static Data dataItem( final CharSeeker data, @@ -921,14 +907,7 @@ private Set labels( String... labels ) private Header.Factory header( final Header.Entry... entries ) { - return new Header.Factory() - { - @Override - public Header create( CharSeeker from, Configuration configuration, IdType idType ) - { - return new Header( entries ); - } - }; + return ( from, configuration, idType ) -> new Header( entries ); } private Header.Entry entry( String name, Type type, Extractor extractor ) @@ -949,14 +928,7 @@ private static DataFactory data( final Stri private static DataFactory data( final String data, final Function decorator ) { - return new DataFactory() - { - @Override - public Data create( Configuration config ) - { - return dataItem( charSeeker( data ), decorator ); - } - }; + return config -> dataItem( charSeeker( data ), decorator ); } private static final org.neo4j.csv.reader.Configuration SEEKER_CONFIG =