Java 11 migrate remaining p (#1122)

* Moves partial-response to Java 11

* Moves pipeline to Java 11

* Moves poison-pill to Java 11

* Moves priority-queue to Java 11

* Moves private-class-data to Java 11

* Moves producer-consumer to Java 11

* Moves promise to Java 11

* Moves property to Java 11

* Moves prototype to Java 11

* Moves proxy to Java 11

* Corrects checkstyle errors

* Fixes build for pipeline pattern
This commit is contained in:
Anurag Agarwal
2020-01-16 11:36:36 +05:30
committed by Ilkka Seppälä
parent 1401accb4f
commit 428efc7d53
82 changed files with 532 additions and 601 deletions

View File

@ -36,11 +36,12 @@ class ConvertToCharArrayHandler implements Handler<String, char[]> {
@Override
public char[] process(String input) {
char[] characters = input.toCharArray();
LOGGER
.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s",
ConvertToCharArrayHandler.class, input, String.class, Arrays
.toString(characters), Character[].class));
var characters = input.toCharArray();
var string = Arrays.toString(characters);
LOGGER.info(
String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s",
ConvertToCharArrayHandler.class, input, String.class, string, Character[].class)
);
return characters;
}

View File

@ -23,6 +23,7 @@
package com.iluwatar.pipeline;
import java.util.function.IntPredicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,18 +37,14 @@ class RemoveAlphabetsHandler implements Handler<String, String> {
@Override
public String process(String input) {
StringBuilder inputWithoutAlphabets = new StringBuilder();
var inputWithoutAlphabets = new StringBuilder();
var isAlphabetic = (IntPredicate) Character::isAlphabetic;
input.chars()
.filter(isAlphabetic.negate())
.mapToObj(x -> (char) x)
.forEachOrdered(inputWithoutAlphabets::append);
for (int index = 0; index < input.length(); index++) {
char currentCharacter = input.charAt(index);
if (Character.isAlphabetic(currentCharacter)) {
continue;
}
inputWithoutAlphabets.append(currentCharacter);
}
String inputWithoutAlphabetsStr = inputWithoutAlphabets.toString();
var inputWithoutAlphabetsStr = inputWithoutAlphabets.toString();
LOGGER.info(
String.format(
"Current handler: %s, input is %s of type %s, output is %s, of type %s",

View File

@ -23,6 +23,7 @@
package com.iluwatar.pipeline;
import java.util.function.IntPredicate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,21 +37,20 @@ class RemoveDigitsHandler implements Handler<String, String> {
@Override
public String process(String input) {
StringBuilder inputWithoutDigits = new StringBuilder();
var inputWithoutDigits = new StringBuilder();
var isDigit = (IntPredicate) Character::isDigit;
input.chars()
.filter(isDigit.negate())
.mapToObj(x -> (char) x)
.forEachOrdered(inputWithoutDigits::append);
for (int index = 0; index < input.length(); index++) {
char currentCharacter = input.charAt(index);
if (Character.isDigit(currentCharacter)) {
continue;
}
inputWithoutDigits.append(currentCharacter);
}
String inputWithoutDigitsStr = inputWithoutDigits.toString();
LOGGER
.info(String.format("Current handler: %s, input is %s of type %s, output is %s, of type %s",
RemoveDigitsHandler.class, input, String.class, inputWithoutDigitsStr, String.class));
var inputWithoutDigitsStr = inputWithoutDigits.toString();
LOGGER.info(
String.format(
"Current handler: %s, input is %s of type %s, output is %s, of type %s",
RemoveDigitsHandler.class, input, String.class, inputWithoutDigitsStr, String.class
)
);
return inputWithoutDigitsStr;
}

View File

@ -32,7 +32,6 @@ public class AppTest {
@Test
public void test() {
String[] args = {};
App.main(args);
App.main(new String[]{});
}
}

View File

@ -23,10 +23,10 @@
package com.iluwatar.pipeline;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import org.junit.jupiter.api.Test;
/**
* Test for {@link Pipeline}
*/
@ -34,12 +34,12 @@ public class PipelineTest {
@Test
public void testAddHandlersToPipeline() {
Pipeline<String, char[]> filters = new Pipeline<>(new RemoveAlphabetsHandler())
var filters = new Pipeline<>(new RemoveAlphabetsHandler())
.addHandler(new RemoveDigitsHandler())
.addHandler(new ConvertToCharArrayHandler());
assertArrayEquals(
new char[] {'#', '!', '(', '&', '%', '#', '!'},
new char[]{'#', '!', '(', '&', '%', '#', '!'},
filters.execute("#H!E(L&L0O%THE3R#34E!")
);
}