diff --git a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/RouteFinder.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/RouteFinder.java index 35458093c5..f8b66fec88 100644 --- a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/RouteFinder.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/RouteFinder.java @@ -8,6 +8,9 @@ import java.util.PriorityQueue; import java.util.Queue; import java.util.stream.Collectors; +import lombok.extern.slf4j.Slf4j; + +@Slf4j public class RouteFinder { private final Graph graph; private final Scorer nextNodeScorer; @@ -28,11 +31,11 @@ public class RouteFinder { openSet.add(start); while (!openSet.isEmpty()) { - System.out.println("Open Set contains: " + openSet.stream().map(RouteNode::getCurrent).collect(Collectors.toSet())); + log.debug("Open Set contains: " + openSet.stream().map(RouteNode::getCurrent).collect(Collectors.toSet())); RouteNode next = openSet.poll(); - System.out.println("Looking at node: " + next); + log.debug("Looking at node: " + next); if (next.getCurrent().equals(to)) { - System.out.println("Found our destination!"); + log.debug("Found our destination!"); List route = new ArrayList<>(); RouteNode current = next; @@ -41,7 +44,7 @@ public class RouteFinder { current = allNodes.get(current.getPrevious()); } while (current != null); - System.out.println("Route: " + route); + log.debug("Route: " + route); return route; } @@ -55,7 +58,7 @@ public class RouteFinder { nextNode.setRouteScore(newScore); nextNode.setEstimatedScore(newScore + targetScorer.computeCost(connection, to)); openSet.add(nextNode); - System.out.println("Found a better route to node: " + nextNode); + log.debug("Found a better route to node: " + nextNode); } }); } diff --git a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/underground/RouteFinderIntegrationTest.java b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/underground/RouteFinderIntegrationTest.java index 1e4ad56d94..aba7f149da 100644 --- a/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/underground/RouteFinderIntegrationTest.java +++ b/algorithms-miscellaneous-2/src/test/java/com/baeldung/algorithms/astar/underground/RouteFinderIntegrationTest.java @@ -1,5 +1,7 @@ package com.baeldung.algorithms.astar.underground; +import static org.assertj.core.api.Assertions.assertThat; + import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -10,9 +12,13 @@ import java.util.stream.Stream; import com.baeldung.algorithms.astar.Graph; import com.baeldung.algorithms.astar.RouteFinder; + +import lombok.extern.slf4j.Slf4j; + import org.junit.Before; import org.junit.Test; +@Slf4j public class RouteFinderIntegrationTest { private Graph underground; @@ -637,7 +643,8 @@ public class RouteFinderIntegrationTest { @Test public void findRoute() { List route = routeFinder.findRoute(underground.getNode("74"), underground.getNode("7")); + assertThat(route).size().isPositive(); - System.out.println(route.stream().map(Station::getName).collect(Collectors.toList())); + route.stream().map(Station::getName).collect(Collectors.toList()).forEach(station -> log.debug(station)); } } diff --git a/apache-kafka/README.md b/apache-kafka/README.md new file mode 100644 index 0000000000..5e724f95b6 --- /dev/null +++ b/apache-kafka/README.md @@ -0,0 +1,18 @@ +## Apache Kafka + +This module contains articles about Apache Kafka. + +### Relevant articles +- [Kafka Streams vs Kafka Consumer](https://www.baeldung.com/java-kafka-streams-vs-kafka-consumer) +- [Kafka Topic Creation Using Java](https://www.baeldung.com/kafka-topic-creation) +- [Using Kafka MockConsumer](https://www.baeldung.com/kafka-mockconsumer) +- [Using Kafka MockProducer](https://www.baeldung.com/kafka-mockproducer) +- [Introduction to KafkaStreams in Java](https://www.baeldung.com/java-kafka-streams) +- [Introduction to Kafka Connectors](https://www.baeldung.com/kafka-connectors-guide) +- [Kafka Connect Example with MQTT and MongoDB](https://www.baeldung.com/kafka-connect-mqtt-mongodb) +- [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline) +- [Exactly Once Processing in Kafka with Java](https://www.baeldung.com/kafka-exactly-once) + + +##### Building the project +You can build the project from the command line using: *mvn clean install*, or in an IDE. \ No newline at end of file diff --git a/libraries-data-3/log4j.properties b/apache-kafka/log4j.properties similarity index 100% rename from libraries-data-3/log4j.properties rename to apache-kafka/log4j.properties diff --git a/apache-kafka/pom.xml b/apache-kafka/pom.xml new file mode 100644 index 0000000000..cda91ed92f --- /dev/null +++ b/apache-kafka/pom.xml @@ -0,0 +1,180 @@ + + + 4.0.0 + apache-kafka + apache-kafka + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + org.apache.kafka + kafka-clients + ${kafka.version} + + + org.apache.kafka + kafka-streams + ${kafka.version} + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${org.slf4j.version} + + + org.apache.flink + flink-connector-kafka-0.11_2.11 + ${flink.version} + + + org.apache.flink + flink-streaming-java_2.11 + ${flink.version} + + + org.apache.flink + flink-core + ${flink.version} + + + commons-logging + commons-logging + + + + + org.apache.flink + flink-java + ${flink.version} + + + commons-logging + commons-logging + + + + + org.apache.flink + flink-test-utils_2.11 + ${flink.version} + test + + + com.google.guava + guava + ${guava.version} + + + org.awaitility + awaitility + ${awaitility.version} + test + + + org.awaitility + awaitility-proxy + ${awaitility.version} + test + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.testcontainers + kafka + ${testcontainers-kafka.version} + test + + + org.testcontainers + junit-jupiter + ${testcontainers-jupiter.version} + test + + + org.apache.spark + spark-core_2.11 + ${org.apache.spark.spark-core.version} + provided + + + org.apache.spark + spark-sql_2.11 + ${org.apache.spark.spark-core.version} + provided + + + org.apache.spark + spark-graphx_2.11 + ${org.apache.spark.spark-core.version} + provided + + + org.apache.spark + spark-streaming_2.11 + ${org.apache.spark.spark-core.version} + provided + + + org.apache.spark + spark-mllib_2.11 + ${org.apache.spark.spark-core.version} + provided + + + org.apache.spark + spark-streaming-kafka-0-10_2.11 + ${org.apache.spark.spark-core.version} + + + com.datastax.spark + spark-cassandra-connector_2.11 + ${com.datastax.spark.spark-cassandra-connector.version} + + + com.datastax.spark + spark-cassandra-connector-java_2.11 + ${com.datastax.spark.spark-cassandra-connector-java.version} + + + + + 3.6.2 + 2.8.0 + 1.15.3 + 1.15.3 + 1.5.0 + 3.0.0 + 29.0-jre + 2.4.8 + 0.8.1-spark3.0-s_2.12 + 2.5.2 + 1.6.0-M1 + + + \ No newline at end of file diff --git a/apache-kafka/src/main/java/com/baeldung/flink/FlinkDataPipeline.java b/apache-kafka/src/main/java/com/baeldung/flink/FlinkDataPipeline.java new file mode 100644 index 0000000000..4502b628b2 --- /dev/null +++ b/apache-kafka/src/main/java/com/baeldung/flink/FlinkDataPipeline.java @@ -0,0 +1,70 @@ +package com.baeldung.flink; + +import com.baeldung.flink.model.Backup; +import com.baeldung.flink.model.InputMessage; +import com.baeldung.flink.operator.BackupAggregator; +import com.baeldung.flink.operator.InputMessageTimestampAssigner; +import com.baeldung.flink.operator.WordsCapitalizer; +import org.apache.flink.streaming.api.TimeCharacteristic; +import org.apache.flink.streaming.api.datastream.DataStream; +import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; +import org.apache.flink.streaming.api.windowing.time.Time; +import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer011; +import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer011; + +import static com.baeldung.flink.connector.Consumers.*; +import static com.baeldung.flink.connector.Producers.*; + +public class FlinkDataPipeline { + + public static void capitalize() throws Exception { + String inputTopic = "flink_input"; + String outputTopic = "flink_output"; + String consumerGroup = "baeldung"; + String address = "localhost:9092"; + + StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment(); + + FlinkKafkaConsumer011 flinkKafkaConsumer = createStringConsumerForTopic(inputTopic, address, consumerGroup); + flinkKafkaConsumer.setStartFromEarliest(); + + DataStream stringInputStream = environment.addSource(flinkKafkaConsumer); + + FlinkKafkaProducer011 flinkKafkaProducer = createStringProducer(outputTopic, address); + + stringInputStream.map(new WordsCapitalizer()) + .addSink(flinkKafkaProducer); + + environment.execute(); + } + + public static void createBackup() throws Exception { + String inputTopic = "flink_input"; + String outputTopic = "flink_output"; + String consumerGroup = "baeldung"; + String kafkaAddress = "localhost:9092"; + + StreamExecutionEnvironment environment = StreamExecutionEnvironment.getExecutionEnvironment(); + + environment.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); + + FlinkKafkaConsumer011 flinkKafkaConsumer = createInputMessageConsumer(inputTopic, kafkaAddress, consumerGroup); + flinkKafkaConsumer.setStartFromEarliest(); + + flinkKafkaConsumer.assignTimestampsAndWatermarks(new InputMessageTimestampAssigner()); + FlinkKafkaProducer011 flinkKafkaProducer = createBackupProducer(outputTopic, kafkaAddress); + + DataStream inputMessagesStream = environment.addSource(flinkKafkaConsumer); + + inputMessagesStream.timeWindowAll(Time.hours(24)) + .aggregate(new BackupAggregator()) + .addSink(flinkKafkaProducer); + + environment.execute(); + } + + public static void main(String[] args) throws Exception { + createBackup(); + } + +} diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/connector/Consumers.java b/apache-kafka/src/main/java/com/baeldung/flink/connector/Consumers.java similarity index 53% rename from libraries-data-2/src/main/java/com/baeldung/flink/connector/Consumers.java rename to apache-kafka/src/main/java/com/baeldung/flink/connector/Consumers.java index 514085f9c4..c72cb8a2d6 100644 --- a/libraries-data-2/src/main/java/com/baeldung/flink/connector/Consumers.java +++ b/apache-kafka/src/main/java/com/baeldung/flink/connector/Consumers.java @@ -9,23 +9,20 @@ import java.util.Properties; public class Consumers { -public static FlinkKafkaConsumer011 createStringConsumerForTopic( - String topic, String kafkaAddress, String kafkaGroup ) { - Properties props = new Properties(); - props.setProperty("bootstrap.servers", kafkaAddress); - props.setProperty("group.id",kafkaGroup); - FlinkKafkaConsumer011 consumer = - new FlinkKafkaConsumer011<>(topic, new SimpleStringSchema(),props); + public static FlinkKafkaConsumer011 createStringConsumerForTopic(String topic, String kafkaAddress, String kafkaGroup) { + Properties props = new Properties(); + props.setProperty("bootstrap.servers", kafkaAddress); + props.setProperty("group.id", kafkaGroup); + FlinkKafkaConsumer011 consumer = new FlinkKafkaConsumer011<>(topic, new SimpleStringSchema(), props); - return consumer; -} + return consumer; + } - public static FlinkKafkaConsumer011 createInputMessageConsumer(String topic, String kafkaAddress, String kafkaGroup ) { + public static FlinkKafkaConsumer011 createInputMessageConsumer(String topic, String kafkaAddress, String kafkaGroup) { Properties properties = new Properties(); properties.setProperty("bootstrap.servers", kafkaAddress); - properties.setProperty("group.id",kafkaGroup); - FlinkKafkaConsumer011 consumer = new FlinkKafkaConsumer011( - topic, new InputMessageDeserializationSchema(),properties); + properties.setProperty("group.id", kafkaGroup); + FlinkKafkaConsumer011 consumer = new FlinkKafkaConsumer011(topic, new InputMessageDeserializationSchema(), properties); return consumer; } diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/connector/Producers.java b/apache-kafka/src/main/java/com/baeldung/flink/connector/Producers.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/flink/connector/Producers.java rename to apache-kafka/src/main/java/com/baeldung/flink/connector/Producers.java diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/model/Backup.java b/apache-kafka/src/main/java/com/baeldung/flink/model/Backup.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/flink/model/Backup.java rename to apache-kafka/src/main/java/com/baeldung/flink/model/Backup.java diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/model/InputMessage.java b/apache-kafka/src/main/java/com/baeldung/flink/model/InputMessage.java similarity index 82% rename from libraries-data-2/src/main/java/com/baeldung/flink/model/InputMessage.java rename to apache-kafka/src/main/java/com/baeldung/flink/model/InputMessage.java index b3f75256ae..d33eb5a9ac 100644 --- a/libraries-data-2/src/main/java/com/baeldung/flink/model/InputMessage.java +++ b/apache-kafka/src/main/java/com/baeldung/flink/model/InputMessage.java @@ -18,6 +18,7 @@ public class InputMessage { public String getSender() { return sender; } + public void setSender(String sender) { this.sender = sender; } @@ -55,12 +56,14 @@ public class InputMessage { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; InputMessage message1 = (InputMessage) o; - return Objects.equal(sender, message1.sender) && - Objects.equal(recipient, message1.recipient) && - Objects.equal(sentAt, message1.sentAt) && + return Objects.equal(sender, message1.sender) && + Objects.equal(recipient, message1.recipient) && + Objects.equal(sentAt, message1.sentAt) && Objects.equal(message, message1.message); } diff --git a/apache-kafka/src/main/java/com/baeldung/flink/operator/BackupAggregator.java b/apache-kafka/src/main/java/com/baeldung/flink/operator/BackupAggregator.java new file mode 100644 index 0000000000..bac1c8c705 --- /dev/null +++ b/apache-kafka/src/main/java/com/baeldung/flink/operator/BackupAggregator.java @@ -0,0 +1,34 @@ +package com.baeldung.flink.operator; + +import com.baeldung.flink.model.Backup; +import com.baeldung.flink.model.InputMessage; +import org.apache.flink.api.common.functions.AggregateFunction; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +public class BackupAggregator implements AggregateFunction, Backup> { + @Override + public List createAccumulator() { + return new ArrayList<>(); + } + + @Override + public List add(InputMessage inputMessage, List inputMessages) { + inputMessages.add(inputMessage); + return inputMessages; + } + + @Override + public Backup getResult(List inputMessages) { + Backup backup = new Backup(inputMessages, LocalDateTime.now()); + return backup; + } + + @Override + public List merge(List inputMessages, List acc1) { + inputMessages.addAll(acc1); + return inputMessages; + } +} diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java b/apache-kafka/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java similarity index 88% rename from libraries-data-2/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java rename to apache-kafka/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java index 05828d9588..995fe41717 100644 --- a/libraries-data-2/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java +++ b/apache-kafka/src/main/java/com/baeldung/flink/operator/InputMessageTimestampAssigner.java @@ -12,7 +12,9 @@ public class InputMessageTimestampAssigner implements AssignerWithPunctuatedWate @Override public long extractTimestamp(InputMessage element, long previousElementTimestamp) { ZoneId zoneId = ZoneId.systemDefault(); - return element.getSentAt().atZone(zoneId).toEpochSecond() * 1000; + return element.getSentAt() + .atZone(zoneId) + .toEpochSecond() * 1000; } @Nullable diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/operator/WordsCapitalizer.java b/apache-kafka/src/main/java/com/baeldung/flink/operator/WordsCapitalizer.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/flink/operator/WordsCapitalizer.java rename to apache-kafka/src/main/java/com/baeldung/flink/operator/WordsCapitalizer.java diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java b/apache-kafka/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java similarity index 90% rename from libraries-data-2/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java rename to apache-kafka/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java index 967b266bb6..d4b7b0955a 100644 --- a/libraries-data-2/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java +++ b/apache-kafka/src/main/java/com/baeldung/flink/schema/BackupSerializationSchema.java @@ -9,8 +9,7 @@ import org.apache.flink.api.common.serialization.SerializationSchema; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BackupSerializationSchema - implements SerializationSchema { +public class BackupSerializationSchema implements SerializationSchema { static ObjectMapper objectMapper = new ObjectMapper().registerModule(new JavaTimeModule()); @@ -18,7 +17,7 @@ public class BackupSerializationSchema @Override public byte[] serialize(Backup backupMessage) { - if(objectMapper == null) { + if (objectMapper == null) { objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); objectMapper = new ObjectMapper().registerModule(new JavaTimeModule()); } diff --git a/libraries-data-2/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java b/apache-kafka/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java similarity index 89% rename from libraries-data-2/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java rename to apache-kafka/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java index 9aaf8b9877..e521af7c2d 100644 --- a/libraries-data-2/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java +++ b/apache-kafka/src/main/java/com/baeldung/flink/schema/InputMessageDeserializationSchema.java @@ -8,12 +8,10 @@ import org.apache.flink.api.common.typeinfo.TypeInformation; import java.io.IOException; -public class InputMessageDeserializationSchema implements - DeserializationSchema { +public class InputMessageDeserializationSchema implements DeserializationSchema { static ObjectMapper objectMapper = new ObjectMapper().registerModule(new JavaTimeModule()); - @Override public InputMessage deserialize(byte[] bytes) throws IOException { diff --git a/libraries-data-3/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java b/apache-kafka/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java similarity index 77% rename from libraries-data-3/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java rename to apache-kafka/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java index 0d74e27d4e..25d621166d 100644 --- a/libraries-data-3/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/admin/KafkaTopicApplication.java @@ -27,11 +27,11 @@ public class KafkaTopicApplication { short replicationFactor = 1; NewTopic newTopic = new NewTopic(topicName, partitions, replicationFactor); - CreateTopicsResult result = admin.createTopics( - Collections.singleton(newTopic)); + CreateTopicsResult result = admin.createTopics(Collections.singleton(newTopic)); // get the async result for the new topic creation - KafkaFuture future = result.values().get(topicName); + KafkaFuture future = result.values() + .get(topicName); // call get() to block until topic creation has completed or failed future.get(); @@ -47,15 +47,13 @@ public class KafkaTopicApplication { short replicationFactor = 1; NewTopic newTopic = new NewTopic(topicName, partitions, replicationFactor); - CreateTopicsOptions topicOptions = new CreateTopicsOptions() - .validateOnly(true) - .retryOnQuotaViolation(true); + CreateTopicsOptions topicOptions = new CreateTopicsOptions().validateOnly(true) + .retryOnQuotaViolation(true); - CreateTopicsResult result = admin.createTopics( - Collections.singleton(newTopic), topicOptions - ); + CreateTopicsResult result = admin.createTopics(Collections.singleton(newTopic), topicOptions); - KafkaFuture future = result.values().get(topicName); + KafkaFuture future = result.values() + .get(topicName); future.get(); } } @@ -72,14 +70,12 @@ public class KafkaTopicApplication { Map newTopicConfig = new HashMap<>(); newTopicConfig.put(TopicConfig.CLEANUP_POLICY_CONFIG, TopicConfig.CLEANUP_POLICY_COMPACT); newTopicConfig.put(TopicConfig.COMPRESSION_TYPE_CONFIG, "lz4"); - NewTopic newTopic = new NewTopic(topicName, partitions, replicationFactor) - .configs(newTopicConfig); + NewTopic newTopic = new NewTopic(topicName, partitions, replicationFactor).configs(newTopicConfig); - CreateTopicsResult result = admin.createTopics( - Collections.singleton(newTopic) - ); + CreateTopicsResult result = admin.createTopics(Collections.singleton(newTopic)); - KafkaFuture future = result.values().get(topicName); + KafkaFuture future = result.values() + .get(topicName); future.get(); } } diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/consumer/CountryPopulation.java b/apache-kafka/src/main/java/com/baeldung/kafka/consumer/CountryPopulation.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/kafka/consumer/CountryPopulation.java rename to apache-kafka/src/main/java/com/baeldung/kafka/consumer/CountryPopulation.java diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java b/apache-kafka/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java similarity index 89% rename from libraries-data-2/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java rename to apache-kafka/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java index ba4dfe6f3b..a67d3a581c 100644 --- a/libraries-data-2/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/consumer/CountryPopulationConsumer.java @@ -19,9 +19,7 @@ public class CountryPopulationConsumer { private java.util.function.Consumer exceptionConsumer; private java.util.function.Consumer countryPopulationConsumer; - public CountryPopulationConsumer( - Consumer consumer, java.util.function.Consumer exceptionConsumer, - java.util.function.Consumer countryPopulationConsumer) { + public CountryPopulationConsumer(Consumer consumer, java.util.function.Consumer exceptionConsumer, java.util.function.Consumer countryPopulationConsumer) { this.consumer = consumer; this.exceptionConsumer = exceptionConsumer; this.countryPopulationConsumer = countryPopulationConsumer; diff --git a/libraries-6/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalMessageProducer.java similarity index 87% rename from libraries-6/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java rename to apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalMessageProducer.java index 15488bbaf4..8f2fe6e309 100644 --- a/libraries-6/src/main/java/com/baeldung/kafka/TransactionalMessageProducer.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalMessageProducer.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.exactlyonce; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord; @@ -24,16 +24,16 @@ public class TransactionalMessageProducer { producer.initTransactions(); - try{ + try { producer.beginTransaction(); - Stream.of(DATA_MESSAGE_1, DATA_MESSAGE_2).forEach(s -> producer.send( - new ProducerRecord("input", null, s))); + Stream.of(DATA_MESSAGE_1, DATA_MESSAGE_2) + .forEach(s -> producer.send(new ProducerRecord("input", null, s))); producer.commitTransaction(); - }catch (KafkaException e){ + } catch (KafkaException e) { producer.abortTransaction(); diff --git a/libraries-6/src/main/java/com/baeldung/kafka/TransactionalWordCount.java b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalWordCount.java similarity index 90% rename from libraries-6/src/main/java/com/baeldung/kafka/TransactionalWordCount.java rename to apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalWordCount.java index 0563ba6684..b9a2cb9f85 100644 --- a/libraries-6/src/main/java/com/baeldung/kafka/TransactionalWordCount.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/TransactionalWordCount.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.exactlyonce; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; @@ -43,10 +43,11 @@ public class TransactionalWordCount { ConsumerRecords records = consumer.poll(ofSeconds(60)); Map wordCountMap = records.records(new TopicPartition(INPUT_TOPIC, 0)) - .stream() - .flatMap(record -> Stream.of(record.value().split(" "))) - .map(word -> Tuple.of(word, 1)) - .collect(Collectors.toMap(tuple -> tuple.getKey(), t1 -> t1.getValue(), (v1, v2) -> v1 + v2)); + .stream() + .flatMap(record -> Stream.of(record.value() + .split(" "))) + .map(word -> Tuple.of(word, 1)) + .collect(Collectors.toMap(tuple -> tuple.getKey(), t1 -> t1.getValue(), (v1, v2) -> v1 + v2)); producer.beginTransaction(); @@ -56,7 +57,8 @@ public class TransactionalWordCount { for (TopicPartition partition : records.partitions()) { List> partitionedRecords = records.records(partition); - long offset = partitionedRecords.get(partitionedRecords.size() - 1).offset(); + long offset = partitionedRecords.get(partitionedRecords.size() - 1) + .offset(); offsetsToCommit.put(partition, new OffsetAndMetadata(offset + 1)); } @@ -72,7 +74,6 @@ public class TransactionalWordCount { } - } private static KafkaConsumer createKafkaConsumer() { diff --git a/libraries-6/src/main/java/com/baeldung/kafka/Tuple.java b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/Tuple.java similarity index 69% rename from libraries-6/src/main/java/com/baeldung/kafka/Tuple.java rename to apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/Tuple.java index 883de4ba21..ad61e905fd 100644 --- a/libraries-6/src/main/java/com/baeldung/kafka/Tuple.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/exactlyonce/Tuple.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka; +package com.baeldung.kafka.exactlyonce; public class Tuple { @@ -10,8 +10,8 @@ public class Tuple { this.value = value; } - public static Tuple of(String key, Integer value){ - return new Tuple(key,value); + public static Tuple of(String key, Integer value) { + return new Tuple(key, value); } public String getKey() { diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java b/apache-kafka/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java similarity index 100% rename from libraries-data-2/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java rename to apache-kafka/src/main/java/com/baeldung/kafka/producer/EvenOddPartitioner.java diff --git a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java b/apache-kafka/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java similarity index 95% rename from libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java rename to apache-kafka/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java index 911c9ed3d7..fa508593e0 100644 --- a/libraries-data-2/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java +++ b/apache-kafka/src/main/java/com/baeldung/kafka/producer/KafkaProducer.java @@ -15,8 +15,7 @@ public class KafkaProducer { } public Future send(String key, String value) { - ProducerRecord record = new ProducerRecord("topic_sports_news", - key, value); + ProducerRecord record = new ProducerRecord("topic_sports_news", key, value); return producer.send(record); } @@ -36,5 +35,4 @@ public class KafkaProducer { producer.commitTransaction(); } - } diff --git a/libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-file-sink.properties b/apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-file-sink.properties similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-file-sink.properties rename to apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-file-sink.properties diff --git a/libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-file-source.properties b/apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-file-source.properties similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-file-source.properties rename to apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-file-source.properties diff --git a/libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-standalone.properties b/apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-standalone.properties similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/01_Quick_Start/connect-standalone.properties rename to apache-kafka/src/main/resources/kafka-connect/01_Quick_Start/connect-standalone.properties diff --git a/libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-distributed.properties b/apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-distributed.properties similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-distributed.properties rename to apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-distributed.properties diff --git a/libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-file-sink.json b/apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-file-sink.json similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-file-sink.json rename to apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-file-sink.json diff --git a/libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-file-source.json b/apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-file-source.json similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/02_Distributed/connect-file-source.json rename to apache-kafka/src/main/resources/kafka-connect/02_Distributed/connect-file-source.json diff --git a/libraries-data/src/main/resources/kafka-connect/03_Transform/connect-distributed.properties b/apache-kafka/src/main/resources/kafka-connect/03_Transform/connect-distributed.properties similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/03_Transform/connect-distributed.properties rename to apache-kafka/src/main/resources/kafka-connect/03_Transform/connect-distributed.properties diff --git a/libraries-data/src/main/resources/kafka-connect/03_Transform/connect-file-source-transform.json b/apache-kafka/src/main/resources/kafka-connect/03_Transform/connect-file-source-transform.json similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/03_Transform/connect-file-source-transform.json rename to apache-kafka/src/main/resources/kafka-connect/03_Transform/connect-file-source-transform.json diff --git a/libraries-data/src/main/resources/kafka-connect/04_Custom/connect-mongodb-sink.json b/apache-kafka/src/main/resources/kafka-connect/04_Custom/connect-mongodb-sink.json similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/04_Custom/connect-mongodb-sink.json rename to apache-kafka/src/main/resources/kafka-connect/04_Custom/connect-mongodb-sink.json diff --git a/libraries-data/src/main/resources/kafka-connect/04_Custom/connect-mqtt-source.json b/apache-kafka/src/main/resources/kafka-connect/04_Custom/connect-mqtt-source.json similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/04_Custom/connect-mqtt-source.json rename to apache-kafka/src/main/resources/kafka-connect/04_Custom/connect-mqtt-source.json diff --git a/libraries-data/src/main/resources/kafka-connect/04_Custom/docker-compose.yaml b/apache-kafka/src/main/resources/kafka-connect/04_Custom/docker-compose.yaml similarity index 100% rename from libraries-data/src/main/resources/kafka-connect/04_Custom/docker-compose.yaml rename to apache-kafka/src/main/resources/kafka-connect/04_Custom/docker-compose.yaml diff --git a/libraries-data-2/src/test/java/com/baeldung/flink/BackupCreatorIntegrationTest.java b/apache-kafka/src/test/java/com/baeldung/flink/BackupCreatorIntegrationTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/flink/BackupCreatorIntegrationTest.java rename to apache-kafka/src/test/java/com/baeldung/flink/BackupCreatorIntegrationTest.java diff --git a/libraries-data-2/src/test/java/com/baeldung/flink/WordCapitalizerIntegrationTest.java b/apache-kafka/src/test/java/com/baeldung/flink/WordCapitalizerIntegrationTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/flink/WordCapitalizerIntegrationTest.java rename to apache-kafka/src/test/java/com/baeldung/flink/WordCapitalizerIntegrationTest.java diff --git a/libraries-data-3/src/test/java/com/baeldung/kafka/admin/KafkaTopicApplicationIntegrationTest.java b/apache-kafka/src/test/java/com/baeldung/kafka/admin/KafkaTopicApplicationIntegrationTest.java similarity index 100% rename from libraries-data-3/src/test/java/com/baeldung/kafka/admin/KafkaTopicApplicationIntegrationTest.java rename to apache-kafka/src/test/java/com/baeldung/kafka/admin/KafkaTopicApplicationIntegrationTest.java diff --git a/libraries-data-2/src/test/java/com/baeldung/kafka/consumer/CountryPopulationConsumerUnitTest.java b/apache-kafka/src/test/java/com/baeldung/kafka/consumer/CountryPopulationConsumerUnitTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/kafka/consumer/CountryPopulationConsumerUnitTest.java rename to apache-kafka/src/test/java/com/baeldung/kafka/consumer/CountryPopulationConsumerUnitTest.java diff --git a/libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java b/apache-kafka/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java similarity index 100% rename from libraries-data-2/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java rename to apache-kafka/src/test/java/com/baeldung/kafka/producer/KafkaProducerUnitTest.java diff --git a/libraries-data-3/src/test/java/com/baeldung/kafka/streams/KafkaStreamsLiveTest.java b/apache-kafka/src/test/java/com/baeldung/kafka/streamsvsconsumer/KafkaStreamsLiveTest.java similarity index 99% rename from libraries-data-3/src/test/java/com/baeldung/kafka/streams/KafkaStreamsLiveTest.java rename to apache-kafka/src/test/java/com/baeldung/kafka/streamsvsconsumer/KafkaStreamsLiveTest.java index 0d4c0606e3..88de6101dc 100644 --- a/libraries-data-3/src/test/java/com/baeldung/kafka/streams/KafkaStreamsLiveTest.java +++ b/apache-kafka/src/test/java/com/baeldung/kafka/streamsvsconsumer/KafkaStreamsLiveTest.java @@ -1,4 +1,4 @@ -package com.baeldung.kafka.streams; +package com.baeldung.kafka.streamsvsconsumer; import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.producer.KafkaProducer; diff --git a/libraries-data/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java b/apache-kafka/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java similarity index 53% rename from libraries-data/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java rename to apache-kafka/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java index 32568e9ea5..3b559b619e 100644 --- a/libraries-data/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java +++ b/apache-kafka/src/test/java/com/baeldung/kafkastreams/KafkaStreamsLiveTest.java @@ -1,61 +1,78 @@ package com.baeldung.kafkastreams; -import org.apache.kafka.clients.consumer.ConsumerConfig; -import org.apache.kafka.common.serialization.Serde; -import org.apache.kafka.common.serialization.Serdes; -import org.apache.kafka.streams.KafkaStreams; -import org.apache.kafka.streams.StreamsConfig; -import org.apache.kafka.streams.kstream.KStream; -import org.apache.kafka.streams.kstream.KStreamBuilder; -import org.apache.kafka.streams.kstream.KTable; -import org.apache.kafka.test.TestUtils; -import org.junit.Ignore; -import org.junit.Test; - +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.Properties; import java.util.regex.Pattern; +import org.apache.kafka.clients.consumer.ConsumerConfig; +import org.apache.kafka.common.serialization.Serdes; +import org.apache.kafka.streams.KafkaStreams; +import org.apache.kafka.streams.StreamsBuilder; +import org.apache.kafka.streams.StreamsConfig; +import org.apache.kafka.streams.Topology; +import org.apache.kafka.streams.kstream.KStream; +import org.apache.kafka.streams.kstream.KTable; +import org.apache.kafka.streams.kstream.Produced; +import org.junit.Ignore; +import org.junit.Test; + public class KafkaStreamsLiveTest { private String bootstrapServers = "localhost:9092"; + private Path stateDirectory; @Test @Ignore("it needs to have kafka broker running on local") public void shouldTestKafkaStreams() throws InterruptedException { - //given + // given String inputTopic = "inputTopic"; Properties streamsConfiguration = new Properties(); streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, "wordcount-live-test"); streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); - streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); - streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); + streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String() + .getClass() + .getName()); + streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String() + .getClass() + .getName()); streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 1000); streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); + // Use a temporary directory for storing state, which will be automatically removed after the test. - streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getAbsolutePath()); + try { + this.stateDirectory = Files.createTempDirectory("kafka-streams"); + streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, this.stateDirectory.toAbsolutePath() + .toString()); + } catch (final IOException e) { + throw new UncheckedIOException("Cannot create temporary directory", e); + } - //when - KStreamBuilder builder = new KStreamBuilder(); + // when + final StreamsBuilder builder = new StreamsBuilder(); KStream textLines = builder.stream(inputTopic); Pattern pattern = Pattern.compile("\\W+", Pattern.UNICODE_CHARACTER_CLASS); - KTable wordCounts = textLines - .flatMapValues(value -> Arrays.asList(pattern.split(value.toLowerCase()))) - .groupBy((key, word) -> word) - .count(); + KTable wordCounts = textLines.flatMapValues(value -> Arrays.asList(pattern.split(value.toLowerCase()))) + .groupBy((key, word) -> word) + .count(); - wordCounts.foreach((word, count) -> System.out.println("word: " + word + " -> " + count)); + wordCounts.toStream() + .foreach((word, count) -> System.out.println("word: " + word + " -> " + count)); String outputTopic = "outputTopic"; - final Serde stringSerde = Serdes.String(); - final Serde longSerde = Serdes.Long(); - wordCounts.to(stringSerde, longSerde, outputTopic); - KafkaStreams streams = new KafkaStreams(builder, streamsConfiguration); + wordCounts.toStream() + .to(outputTopic, Produced.with(Serdes.String(), Serdes.Long())); + + final Topology topology = builder.build(); + KafkaStreams streams = new KafkaStreams(topology, streamsConfiguration); streams.start(); - //then + // then Thread.sleep(30000); streams.close(); } diff --git a/apache-libraries/src/main/resources/models/en-lemmatizer.dict b/apache-libraries/src/main/resources/models/en-lemmatizer.dict new file mode 100644 index 0000000000..7f17fe829f --- /dev/null +++ b/apache-libraries/src/main/resources/models/en-lemmatizer.dict @@ -0,0 +1,3181 @@ +a DT a +a-horizon NN a-horizon +a-okay JJ a-okay +a-one JJ a-one +a-year JJ a-year +a.k.a. RB a.k.a. +contents NNS content +contents VBZ content +hairnets NNS hairnet +hairpiece NN hairpiece +hairpieces NNS hairpiece +hairpin NN hairpin +hairpins NNS hairpin +hairs NNS hair +hairsbreadth NN hairsbreadth +hairsbreadths NNS hairsbreadth +hairsplitter NN hairsplitter +hairsplitters NNS hairsplitter +hairsplitting JJ hairsplitting +hairsplitting NN hairsplitting +hairsplittings NNS hairsplitting +hairspray NN hairspray +hairsprays NNS hairspray +hairspring NN hairspring +hairsprings NNS hairspring +hairstreak NN hairstreak +hairstreaks NNS hairstreak +hairstyle NN hairstyle +hairstyles NNS hairstyle +hairstyling NN hairstyling +hairstylings NNS hairstyling +hairstylist NN hairstylist +hairstylists NNS hairstylist +hairtail NN hairtail +hairtonic NN hairtonic +hairtrigger NNS hair-trigger +hairweaver NN hairweaver +hairweavers NNS hairweaver +hairweaving NN hairweaving +hairweavings NNS hairweaving +hairwork NN hairwork +hairworks NNS hairwork +hairworm NN hairworm +hairworms NNS hairworm +hairy JJ hairy +hairy-faced JJ hairy-faced +haith NN haith +haiths NNS haith +haj NN haj +hajes NNS haj +hajes NNS hajis +haji NN haji +hajis NN hajis +hajis NNS haji +hajj NN hajj +hajjes NNS hajj +hajjes NNS hajjis +hajji NN hajji +hajjis NN hajjis +hajjis NNS hajji +haka NN haka +hakam NN hakam +hakams NNS hakam +hakas NNS haka +hake NN hake +hake NNS hake +hakea NN hakea +hakeem NN hakeem +hakeems NNS hakeem +hakes NNS hake +hakim NN hakim +hakims NNS hakim +hakka NN hakka +haku NN haku +hakus NNS haku +halacha NN halacha +halachas NNS halacha +halachic JJ halachic +halachist NN halachist +halachists NNS halachist +halakah NN halakah +halakahs NNS halakah +halakha NN halakha +halakhah NN halakhah +halakhahs NNS halakhah +halakhas NNS halakha +halakhist NN halakhist +halakhists NNS halakhist +halakist NN halakist +halakists NNS halakist +halal JJ halal +halal NN halal +halala NN halala +halalah NN halalah +halalahs NNS halalah +halalas NNS halala +halalling NN halalling +halalling NNS halalling +halals NNS halal +halation NNN halation +halations NNS halation +halavah NN halavah +halavahs NNS halavah +halazone NN halazone +halazones NNS halazone +halberd NN halberd +halberdier NN halberdier +halberdiers NNS halberdier +halberds NNS halberd +halbert NN halbert +halberts NNS halbert +halchidhoma NN halchidhoma +halcyon JJ halcyon +halcyon NN halcyon +haldea NN haldea +hale JJ hale +hale VB hale +hale VBP hale +haled VBD hale +haled VBN hale +haleness NN haleness +halenesses NNS haleness +halenia NN halenia +haler NN haler +haler JJR hale +halers NNS haler +hales VBZ hale +halesia NN halesia +halest JJS hale +half DT half +half NN half +half PDT half +half-American JJ half-American +half-Americanized JJ half-Americanized +half-Anglicized JJ half-Anglicized +half-Aristotelian JJ half-Aristotelian +half-Asian JJ half-Asian +half-Asiatic JJ half-Asiatic +half-Christian JJ half-Christian +half-Confederate JJ half-Confederate +half-Creole JJ half-Creole +half-Dacron JJ half-Dacron +half-Elizabethan JJ half-Elizabethan +half-English JJ half-English +half-French JJ half-French +half-German JJ half-German +half-Greek JJ half-Greek +half-Hessian JJ half-Hessian +half-Irish JJ half-Irish +half-Italian JJ half-Italian +half-Latinized JJ half-Latinized +half-Mexican JJ half-Mexican +half-Mohammedan JJ half-Mohammedan +half-Moslem JJ half-Moslem +half-Muhammadan JJ half-Muhammadan +half-Muslim JJ half-Muslim +half-Russian JJ half-Russian +half-Scottish JJ half-Scottish +half-Semitic JJ half-Semitic +half-Shakespearean JJ half-Shakespearean +half-Spanish JJ half-Spanish +half-a-crown NN half-a-crown +half-a-dollar NN half-a-dollar +half-abandoned JJ half-abandoned +half-accustomed JJ half-accustomed +half-acquainted JJ half-acquainted +half-acquiescent JJ half-acquiescent +half-acquiescently RB half-acquiescently +half-acre NN half-acre +half-addressed JJ half-addressed +half-admiring JJ half-admiring +half-admiringly RB half-admiringly +half-admitted JJ half-admitted +half-admittedly RB half-admittedly +half-adream JJ half-adream +half-affianced JJ half-affianced +half-afloat JJ half-afloat +half-afraid JJ half-afraid +half-agreed JJ half-agreed +half-alike JJ half-alike +half-alive JJ half-alive +half-altered JJ half-altered +half-and-half JJ half-and-half +half-and-half NN half-and-half +half-angrily RB half-angrily +half-angry JJ half-angry +half-annoyed JJ half-annoyed +half-annoying JJ half-annoying +half-annoyingly RB half-annoyingly +half-armed JJ half-armed +half-ashamed JJ half-ashamed +half-ashamedly RB half-ashamedly +half-asleep JJ half-asleep +half-assed JJ half-assed +half-awake JJ half-awake +harns NNS harn +haroseth NN haroseth +harp NN harp +harp VB harp +harp VBP harp +harped VBD harp +harped VBN harp +harper NN harper +harpers NNS harper +harpia NN harpia +harpies NNS harpy +harpin NN harpin +harping NNN harping +harping VBG harp +harpings NNS harping +harpins NNS harpin +harpist NN harpist +harpists NNS harpist +harpless JJ harpless +harplike JJ harplike +harpoon NN harpoon +harpoon VB harpoon +harpoon VBP harpoon +harpooned VBD harpoon +harpooned VBN harpoon +harpooneer NN harpooneer +harpooneers NNS harpooneer +harpooner NN harpooner +harpooners NNS harpooner +harpooning VBG harpoon +harpoonlike JJ harpoonlike +harpoons NNS harpoon +harpoons VBZ harpoon +harps NNS harp +harps VBZ harp +harpsichord NN harpsichord +harpsichordist NN harpsichordist +harpsichordists NNS harpsichordist +harpsichords NNS harpsichord +harpulla NN harpulla +harpullia NN harpullia +harpwise RB harpwise +harpy NN harpy +harpylike JJ harpylike +harquebus NN harquebus +harquebuses NNS harquebus +harquebusier NN harquebusier +harquebusiers NNS harquebusier +harridan NN harridan +harridans NNS harridan +harried VBD harry +harried VBN harry +harrier NN harrier +harriers NNS harrier +harries VBZ harry +harrisia NN harrisia +harrow NN harrow +harrow VB harrow +harrow VBP harrow +harrowed VBD harrow +harrowed VBN harrow +harrower NN harrower +harrowers NNS harrower +harrowing JJ harrowing +harrowing VBG harrow +harrowingly RB harrowingly +harrowment NN harrowment +harrows NNS harrow +harrows VBZ harrow +harry VB harry +harry VBP harry +harrying VBG harry +harsh JJ harsh +harshen VB harshen +harshen VBP harshen +harshened VBD harshen +harshened VBN harshen +harshening VBG harshen +harshens VBZ harshen +harsher JJR harsh +harshest JJS harsh +harshly RB harshly +harshness NN harshness +harshnesses NNS harshness +harslet NN harslet +harslets NNS harslet +hart NN hart +hart NNS hart +hartal NN hartal +hartals NNS hartal +hartebeest NN hartebeest +hartebeests NNS hartebeest +harts NNS hart +hartshorn NN hartshorn +hartshorns NNS hartshorn +harum-scarumness NN harum-scarumness +haruspex NN haruspex +haruspical JJ haruspical +haruspication NNN haruspication +haruspications NNS haruspication +haruspices NNS haruspex +haruspicies NNS haruspicy +haruspicy NNN haruspicy +harvest NN harvest +harvest VB harvest +harvest VBP harvest +harvest-lice NN harvest-lice +harvestabilities NNS harvestability +harvestability NNN harvestability +harvestable JJ harvestable +harvested VBD harvest +harvested VBN harvest +harvester NN harvester +harvesters NNS harvester +harvestfish NN harvestfish +harvestfish NNS harvestfish +harvesting NNN harvesting +harvesting VBG harvest +harvestless JJ harvestless +harvestman NN harvestman +harvestmen NNS harvestman +harvests NNS harvest +harvests VBZ harvest +harvesttime NN harvesttime +harvesttimes NNS harvesttime +has VBZ have +has-been NN has-been +has-beens NNS has-been +hasenpfeffer NN hasenpfeffer +hasenpfeffers NNS hasenpfeffer +hash NN hash +hash VB hash +hash VBP hash +hash-slinger NN hash-slinger +hashed VBD hash +hashed VBN hash +hasheesh NN hasheesh +hasheeshes NNS hasheesh +hasher NN hasher +hashes NNS hash +hashes VBZ hash +hashhead NN hashhead +hashheads NNS hashhead +hashing NNN hashing +hashing VBG hash +hashish NN hashish +hashishes NNS hashish +hashmark NN hashmark +hask JJ hask +hask NN hask +haslet NN haslet +haslets NNS haslet +haslock NN haslock +hasn MD have +hasn VBZ have +hasp NN hasp +hasps NNS hasp +hassar NN hassar +hassars NNS hassar +hassel NN hassel +hassels NNS hassel +hassenpfeffer NN hassenpfeffer +hassium NN hassium +hassiums NNS hassium +hassle NNN hassle +hassle VB hassle +hassle VBP hassle +hassled VBD hassle +hassled VBN hassle +hasslefree JJ hasslefree +hassles NNS hassle +hassles VBZ hassle +hassling VBG hassle +hassock NN hassock +hassocks NNS hassock +hast VBZ have +hastate JJ hastate +hastately RB hastately +haste NNN haste +haste VB haste +haste VBP haste +hasted VBD haste +hasted VBN haste +hasteful JJ hasteful +hastefully RB hastefully +hasteless JJ hasteless +hastelessness NN hastelessness +hasten VB hasten +hasten VBP hasten +hastened VBD hasten +hastened VBN hasten +hastener NN hastener +hasteners NNS hastener +hastening JJ hastening +hastening VBG hasten +hastens VBZ hasten +hastes NNS haste +hastes VBZ haste +hastier JJR hasty +hastiest JJS hasty +hastily RB hastily +hastiness NN hastiness +hastinesses NNS hastiness +hasting NNN hasting +hasting VBG haste +hastings NNS hasting +hasty JJ hasty +hat NN hat +hat VB hat +hat VBP hat +hatable JJ hatable +hatband NN hatband +hatbands NNS hatband +hatbox NN hatbox +hatboxes NNS hatbox +hatbrush NN hatbrush +hatbrushes NNS hatbrush +hatch NN hatch +hatch VB hatch +hatch VBP hatch +hatchabilities NNS hatchability +hatchability NNN hatchability +hatchable JJ hatchable +hatchback NN hatchback +hatchbacks NNS hatchback +hatcheck JJ hatcheck +hatcheck NN hatcheck +hatchecks NNS hatcheck +hatched JJ hatched +hatched VBD hatch +hatched VBN hatch +hatchel VB hatchel +hatchel VBP hatchel +hatcheled VBD hatchel +hatcheled VBN hatchel +hatcheling VBG hatchel +hatchelled VBD hatchel +hatchelled VBN hatchel +hatchelling NNN hatchelling +hatchelling NNS hatchelling +hatchelling VBG hatchel +hatchels VBZ hatchel +hatcher NN hatcher +hatcheries NNS hatchery +hatchers NNS hatcher +hatchery NN hatchery +hatches NNS hatch +hatches VBZ hatch +hatchet NN hatchet +hatchetfaced JJ hatchetfaced +hatchetfish NN hatchetfish +hatchetlike JJ hatchetlike +hatchetman NN hatchetman +hatchetmen NNS hatchetman +hatchets NNS hatchet +hatchettite NN hatchettite +hatching JJ hatching +hatching NN hatching +hatching VBG hatch +hatchings NNS hatching +hatchling NN hatchling +hatchling NNS hatchling +hatchment NN hatchment +hatchments NNS hatchment +hatchway NN hatchway +hatchways NNS hatchway +hate NN hate +hate VB hate +hate VBP hate +hateable JJ hateable +hated VBD hate +hated VBN hate +hateful JJ hateful +hatefully RB hatefully +hatefulness NN hatefulness +hatefulnesses NNS hatefulness +hateless JJ hateless +hatemonger NN hatemonger +hatemongering NN hatemongering +hatemongers NNS hatemonger +hater NN hater +haters NNS hater +hates NNS hate +hates VBZ hate +hatful NN hatful +hatfuls NNS hatful +hath VBZ have +hathpace NN hathpace +hating VBG hate +hatiora NN hatiora +hatless JJ hatless +hatlessness NN hatlessness +hatlike JJ hatlike +hatmaker NN hatmaker +hatmakers NNS hatmaker +hatpin NN hatpin +hatpins NNS hatpin +hatrack NN hatrack +hatracks NNS hatrack +hatred NNN hatred +hatreds NNS hatred +hats NNS hat +hats VBZ hat +hatstand NN hatstand +hatstands NNS hatstand +hatted VBD hat +hatted VBN hat +hatter NN hatter +hatteria NN hatteria +hatterias NNS hatteria +hatters NNS hatter +hatting NNN hatting +hatting VBG hat +hattings NNS hatting +hattock NN hattock +hattocks NNS hattock +haubergeon NN haubergeon +haubergeons NNS haubergeon +hauberk NN hauberk +hauberks NNS hauberk +haud NN haud +hauds NNS haud +hauerite NN hauerite +haugh NN haugh +haughs NNS haugh +haughtier JJR haughty +haughtiest JJS haughty +haughtily RB haughtily +haughtiness NN haughtiness +haughtinesses NNS haughtiness +haughty JJ haughty +haul NN haul +haul VB haul +haul VBP haul +haulage NN haulage +haulages NNS haulage +haulback NN haulback +hauld NN hauld +haulds NNS hauld +hauled VBD haul +hauled VBN haul +hauler NN hauler +haulers NNS hauler +haulier NN haulier +hauliers NNS haulier +hauling NNN hauling +hauling VBG haul +haulm NN haulm +haulmier JJR haulmy +haulmiest JJS haulmy +haulms NNS haulm +haulmy JJ haulmy +hauls NNS haul +hauls VBZ haul +haulyard NN haulyard +haulyards NNS haulyard +haunch NN haunch +haunched JJ haunched +haunches NNS haunch +haunchless JJ haunchless +haunt NN haunt +haunt VB haunt +haunt VBP haunt +haunted JJ haunted +haunted VBD haunt +haunted VBN haunt +haunter NN haunter +haunters NNS haunter +haunting JJ haunting +haunting NNN haunting +haunting VBG haunt +hauntingly RB hauntingly +hauntings NNS haunting +haunts NNS haunt +haunts VBZ haunt +hauriant JJ hauriant +hausen NN hausen +hausens NNS hausen +hausfrau NN hausfrau +hausfraus NNS hausfrau +hausmannite NN hausmannite +haussa NN haussa +haust NN haust +haustella NNS haustellum +haustellate JJ haustellate +haustellum NN haustellum +haustoria NNS haustorium +haustorial JJ haustorial +haustorium NN haustorium +hautbois NN hautbois +hautboy NN hautboy +hautboyist NN hautboyist +hautboys NNS hautboy +haute-piece NN haute-piece +hauteur NN hauteur +hauteurs NNS hauteur +hav NN hav +havarti NN havarti +havartis NNS havarti +havasupai NN havasupai +havdalah NN havdalah +havdalahs NNS havdalah +have NN have +have VB have +have VBP have +have-not NN have-not +have-nots NNS have-not +havelock NN havelock +havelocks NNS havelock +haven NN haven +haven MD have +haven VBP have +havenless JJ havenless +havens NNS haven +havenward RB havenward +haveour NN haveour +haveours NNS haveour +haverel NN haverel +haverels NNS haverel +havering NN havering +haverings NNS havering +havers UH havers +haversack NN haversack +haversacks NNS haversack +haversine NN haversine +haversines NNS haversine +haves NNS have +havildar NN havildar +havildars NNS havildar +having NNN having +having VBG have +havings NNS having +havior NN havior +haviors NNS havior +haviour NN haviour +haviours NNS haviour +havoc NN havoc +havocker NN havocker +havockers NNS havocker +havocs NNS havoc +haw NN haw +haw UH haw +haw VB haw +haw VBP haw +haw-haw NN haw-haw +haw-haw UH haw-haw +hawala NN hawala +hawbuck NN hawbuck +hawbuck NNS hawbuck +hawbucks NNS hawbuck +hawed VBD haw +hawed VBN haw +hawfinch NN hawfinch +hawfinches NNS hawfinch +hawing VBG haw +hawk NN hawk +hawk VB hawk +hawk VBP hawk +hawk-eyed JJ hawk-eyed +hawkbell NN hawkbell +hawkbells NNS hawkbell +hawkbill NN hawkbill +hawkbills NNS hawkbill +hawkbit NN hawkbit +hawkbits NNS hawkbit +hawked VBD hawk +hawked VBN hawk +hawker NN hawker +hawkers NNS hawker +hawkey NN hawkey +hawkeys NNS hawkey +hawkie NN hawkie +hawkies NNS hawkie +hawkies NNS hawky +hawking NNN hawking +hawking VBG hawk +hawkings NNS hawking +hawkish JJ hawkish +hawkishness NN hawkishness +hawkishnesses NNS hawkishness +hawklike JJ hawklike +hawkmoth NN hawkmoth +illmanneredness NN illmanneredness +illnature NN illnature +illness NNN illness +illnesses NNS illness +lactary JJ lactary +macroscale NN macroscale +mugginess NN mugginess +mugginesses NNS mugginess +mugging NNN mugging +mugging VBG mug +nabe NN nabe +nabes NNS nabe +nabes NNS nabis +nabis NN nabis +nabk NN nabk +nabks NNS nabk +nabla NN nabla +nablas NNS nabla +nabob NN nabob +naboberies NNS nabobery +nabobery NN nabobery +nabobess NN nabobess +nabobesses NNS nabobess +nabobical JJ nabobical +nabobically RB nabobically +nabobish JJ nabobish +nabobishly RB nabobishly +nabobism NNN nabobism +nabobisms NNS nabobism +nabobs NNS nabob +nabobship NN nabobship +naboom NN naboom +nabs NN nabs +nabs VBZ nab +nabses NNS nabs +nabu NN nabu +nabumetone NN nabumetone +nacarat NN nacarat +nacarats NNS nacarat +nacelle NN nacelle +nacelles NNS nacelle +nach NN nach +nache NN nache +naches NNS nache +naches NNS nach +nacho NN nacho +nachos NNS nacho +nacimiento NN nacimiento +nacket NN nacket +nackets NNS nacket +nacre NN nacre +nacred JJ nacred +nacreous JJ nacreous +nacres NNS nacre +nada NN nada +nadas NNS nada +nadir NN nadir +nadiral JJ nadiral +nadirs NNS nadir +nadolol NN nadolol +nae JJ nae +naemorhedus NN naemorhedus +naething NN naething +naethings NNS naething +naeve NN naeve +naeves NNS naeve +naevi NNS naevus +naevoid JJ naevoid +naevus NN naevus +nafcillin NN nafcillin +naffness NN naffness +nag NN nag +nag VB nag +nag VBP nag +naga NN naga +nagami NN nagami +nagana NN nagana +naganas NNS nagana +nagas NNS naga +nageia NN nageia +nagged VBD nag +nagged VBN nag +nagger NN nagger +naggers NNS nagger +naggier JJR naggy +naggiest JJS naggy +nagging JJ nagging +nagging VBG nag +naggingly RB naggingly +naggingness NN naggingness +naggish JJ naggish +naggy JJ naggy +nagi NN nagi +nagor NN nagor +nagors NNS nagor +nags NNS nag +nags VBZ nag +nagual NN nagual +nahal NN nahal +nahals NNS nahal +naiad NN naiad +naiadaceae NN naiadaceae +naiadales NN naiadales +naiades NNS naiad +naiads NNS naiad +naiant JJ naiant +naias NN naias +naif JJ naif +naif NN naif +naifs NNS naif +naik NN naik +naiki NN naiki +naiks NNS naik +nail NN nail +nail VB nail +nail VBP nail +nail-biting NNN nail-biting +nail-sick JJ nail-sick +nailbitingly RB nailbitingly +nailbrush NN nailbrush +nailbrushes NNS nailbrush +nailed VBD nail +nailed VBN nail +nailer NN nailer +naileries NNS nailery +nailers NNS nailer +nailery NN nailery +nailfile NN nailfile +nailfold NN nailfold +nailfolds NNS nailfold +nailhead NN nailhead +nailheads NNS nailhead +nailing NNN nailing +nailing VBG nail +nailings NNS nailing +nailless JJ nailless +naillike JJ naillike +nailrod NN nailrod +nails NNS nail +nails VBZ nail +nailset NN nailset +nailsets NNS nailset +nailsickness NN nailsickness +nainsook NN nainsook +nainsooks NNS nainsook +naira NN naira +nairas NNS naira +naiskos NN naiskos +naissant JJ naissant +naive JJ naive +naive NN naive +naively RB naively +naiveness NN naiveness +naivenesses NNS naiveness +naiver JJR naive +naives NNS naive +naives NNS naif +naivest JJS naive +naivete NN naivete +naivetes NNS naivete +naiveties NNS naivety +naivetivet NN naivetivet +naivety NN naivety +naja NN naja +najadaceae NN najadaceae +najas NN najas +naked JJ naked +nakeder JJR naked +nakedest JJS naked +nakedly RB nakedly +nakedness NN nakedness +nakednesses NNS nakedness +nakedwood NN nakedwood +naker NN naker +nakers NNS naker +nala NN nala +nalas NNS nala +naled NN naled +naleds NNS naled +nalfon NN nalfon +nalidixic JJ nalidixic +nallah NN nallah +nallahs NNS nallah +nalorphine NN nalorphine +nalorphines NNS nalorphine +naloxone NN naloxone +naloxones NNS naloxone +naltrexone NN naltrexone +naltrexones NNS naltrexone +namability NNN namability +namaskar NN namaskar +namaskars NNS namaskar +namaste NN namaste +namastes NNS namaste +namaycush NN namaycush +namby-pambiness NN namby-pambiness +namby-pamby JJ namby-pamby +namby-pamby NN namby-pamby +namby-pambyish JJ namby-pambyish +namby-pambyism NNN namby-pambyism +name NN name +name VB name +name VBP name +name-caller NN name-caller +name-calling NNN name-calling +name-dropper NN name-dropper +name-dropping NN name-dropping +nameability NNN nameability +nameable JJ nameable +named VBD name +named VBN name +namedrop VB namedrop +namedrop VBP namedrop +namedropped VBD namedrop +namedropped VBN namedrop +namedropper NN namedropper +namedroppers NNS namedropper +namedropping NN namedropping +namedropping VBG namedrop +namedroppings NNS namedropping +namedrops VBZ namedrop +nameko NN nameko +nameless JJ nameless +namelessly RB namelessly +namelessness NN namelessness +namelessnesses NNS namelessness +namely RB namely +nameplate NN nameplate +nameplates NNS nameplate +namer NN namer +namers NNS namer +names NNS name +names VBZ name +namesake NN namesake +namesakes NNS namesake +nametag NN nametag +nametags NNS nametag +nametape NN nametape +nametapes NNS nametape +namibian JJ namibian +naming NNN naming +naming VBG name +namings NNS naming +namma NN namma +nammad NN nammad +namtaru NN namtaru +nan NN nan +nana NN nana +nanako NN nanako +nanas NNS nana +nance NN nance +nancere NN nancere +nances NNS nance +nancies NNS nancy +nancy NN nancy +nancys NNS nancy +nandin NN nandin +nandina NN nandina +nandinas NNS nandina +nandine NN nandine +nandines NNS nandine +nandins NNS nandin +nandoo NN nandoo +nandoos NNS nandoo +nandrolone NN nandrolone +nandu NN nandu +nanism NNN nanism +nanisms NNS nanism +nanjing NN nanjing +nankeen NN nankeen +nankeens NNS nankeen +nankin NN nankin +nankins NNS nankin +nanna NN nanna +nannas NNS nanna +nannies NNS nanny +nannofossil NN nannofossil +nannofossils NNS nannofossil +nannoplankton NN nannoplankton +nannoplanktons NNS nannoplankton +nanny NN nanny +nanny-goat NN nanny-goat +nannyberry NN nannyberry +nannygai NN nannygai +nannygais NNS nannygai +nanobot NN nanobot +nanobots NNS nanobot +nanocephalic JJ nanocephalic +nanocephaly NN nanocephaly +nanocurie NN nanocurie +nanoelectronic JJ nanoelectronic +nanofossil NN nanofossil +nanofossils NNS nanofossil +nanogram NN nanogram +nanograms NNS nanogram +nanoid JJ nanoid +nanometer NN nanometer +nanometers NNS nanometer +nanometre NN nanometre +nanometres NNS nanometre +nanomia NN nanomia +nanoplankton NN nanoplankton +nanoplanktons NNS nanoplankton +nanosecond NN nanosecond +nanoseconds NNS nanosecond +nanotechnologies NNS nanotechnology +nanotechnology NNN nanotechnology +nanotesla NN nanotesla +nanoteslas NNS nanotesla +nanowatt NN nanowatt +nanowatts NNS nanowatt +nans NNS nan +nantua NN nantua +naos NN naos +naoses NNS naos +naovely RB naovely +nap NNN nap +nap VB nap +nap VBP nap +napa NN napa +napaea NN napaea +napalm NN napalm +napalm VB napalm +napalm VBP napalm +napalmed VBD napalm +napalmed VBN napalm +napalming VBG napalm +napalms NNS napalm +napalms VBZ napalm +napas NNS napa +nape NN nape +napea NN napea +naperies NNS napery +napery NN napery +napes NNS nape +naphtha NN naphtha +naphthalene NN naphthalene +naphthalenes NNS naphthalene +naphthalic JJ naphthalic +naphthalin NN naphthalin +naphthaline NN naphthaline +naphthalines NNS naphthaline +naphthalins NNS naphthalin +naphthas NNS naphtha +naphthene NN naphthene +naphthenes NNS naphthene +naphthenic JJ naphthenic +naphthol NN naphthol +naphthols NNS naphthol +naphthoquinone NN naphthoquinone +naphthous JJ naphthous +naphthyl NN naphthyl +naphthylamine NN naphthylamine +naphthylamines NNS naphthylamine +naphthyls NNS naphthyl +naphtol NN naphtol +naphtols NNS naphtol +napiform JJ napiform +napkin NN napkin +napkins NNS napkin +napless JJ napless +naplessness NN naplessness +napoleon NN napoleon +napoleons NNS napoleon +nappa NN nappa +nappas NNS nappa +nappe NN nappe +napped VBD nap +napped VBN nap +napper NN napper +nappers NNS napper +nappie JJ nappie +nappie NN nappie +nappier JJR nappie +nappier JJR nappy +nappies NNS nappie +nappies NNS nappy +nappiest JJS nappie +nappiest JJS nappy +nappiness NN nappiness +nappinesses NNS nappiness +napping VBG nap +nappy JJ nappy +nappy NN nappy +naprapath NN naprapath +naprapathies NNS naprapathy +naprapathy NN naprapathy +naprosyn NN naprosyn +naproxen NN naproxen +naproxens NNS naproxen +naps NNS nap +naps VBZ nap +naptime NN naptime +naptimes NNS naptime +napu NN napu +naranjilla NN naranjilla +narc NN narc +narcein NN narcein +narceine NN narceine +narceines NNS narceine +narceins NNS narcein +narcism NNN narcism +narcisms NNS narcism +narcissi NNS narcissus +narcissism NN narcissism +narcissisms NNS narcissism +narcissist NN narcissist +narcissistic JJ narcissistic +narcissistically RB narcissistically +narcissists NNS narcissist +narcissus NN narcissus +narcissus NNS narcissus +narcissuses NNS narcissus +narcist NN narcist +narcistic JJ narcistic +narcists NNS narcist +narco NN narco +narcoanalyses NNS narcoanalysis +narcoanalysis NN narcoanalysis +narcolepsies NNS narcolepsy +narcolepsy NN narcolepsy +narcoleptic JJ narcoleptic +narcoleptic NN narcoleptic +narcoleptics NNS narcoleptic +narcoma NN narcoma +narcomania NN narcomania +narcomaniac NN narcomaniac +narcomaniacal JJ narcomaniacal +narcomas NNS narcoma +narcomatous JJ narcomatous +narcos NN narcos +narcos NNS narco +narcose JJ narcose +narcose NN narcose +narcoses NNS narcose +narcoses NNS narcos +narcoses NNS narcosis +narcosis NN narcosis +narcosyntheses NNS narcosynthesis +narcosynthesis NN narcosynthesis +narcotic JJ narcotic +narcotic NN narcotic +narcotically RB narcotically +narcoticalness NN narcoticalness +narcoticness NN narcoticness +narcotics NNS narcotic +narcotisation NNN narcotisation +narcotise VB narcotise +narcotise VBP narcotise +narcotised VBD narcotise +narcotised VBN narcotise +narcotises VBZ narcotise +narcotising VBG narcotise +narcotism NNN narcotism +narcotisms NNS narcotism +narcotist NN narcotist +narcotists NNS narcotist +narcotization NN narcotization +narcotizations NNS narcotization +narcotize VB narcotize +narcotize VBP narcotize +narcotized JJ narcotized +narcotized VBD narcotize +narcotized VBN narcotize +narcotizes VBZ narcotize +narcotizing JJ narcotizing +narcotizing VBG narcotize +narcs NNS narc +nard NN nard +nardine JJ nardine +nardo NN nardo +nardoo NN nardoo +nardoos NNS nardoo +nards NNS nard +nare NN nare +nares NNS nare +nares NNS naris +narghile NN narghile +narghiles NNS narghile +nargile NN nargile +nargileh NN nargileh +nargilehs NNS nargileh +nargiles NNS nargile +narial JJ narial +naricorn NN naricorn +naricorns NNS naricorn +naris NN naris +nark NN nark +nark VB nark +nark VBP nark +narked VBD nark +narked VBN nark +narkier JJR narky +narkiest JJS narky +narking VBG nark +narks NNS nark +narks VBZ nark +narky JJ narky +narras NN narras +narrases NNS narras +narratable JJ narratable +narrate VB narrate +narrate VBP narrate +narrated VBD narrate +narrated VBN narrate +narrater NN narrater +narraters NNS narrater +narrates VBZ narrate +narrating VBG narrate +narration NNN narration +narrations NNS narration +narrative JJ narrative +narrative NNN narrative +narratively RB narratively +narratives NNS narrative +narratologies NNS narratology +narratologist NN narratologist +narratologists NNS narratologist +narratology NNN narratology +narrator NN narrator +narrators NNS narrator +narrow JJ narrow +narrow NN narrow +narrow VB narrow +narrow VBP narrow +narrow-fisted JJ narrow-fisted +narrow-gage JJ narrow-gage +narrow-gauge JJ narrow-gauge +narrow-gauged JJ narrow-gauged +narrow-minded JJ narrow-minded +narrow-mindedly RB narrow-mindedly +narrow-mindedness NN narrow-mindedness +narrowboat NN narrowboat +narrowcasting NN narrowcasting +narrowcastings NNS narrowcasting +narrowed JJ narrowed +narrowed VBD narrow +narrowed VBN narrow +narrower JJR narrow +narrowest JJS narrow +narrowing JJ narrowing +narrowing NNN narrowing +narrowing VBG narrow +narrowings NNS narrowing +narrowly RB narrowly +narrowminded JJ narrow-minded +narrowmindedness NNS narrow-mindedness +narrowness NN narrowness +narrownesses NNS narrowness +narrows NNS narrow +narrows VBZ narrow +narthecal JJ narthecal +narthecium NN narthecium +narthex NN narthex +narthexes NNS narthex +nartjie NN nartjie +nartjies NNS nartjie +narwal NN narwal +narwals NNS narwal +narwhal NN narwhal +narwhale NN narwhale +narwhales NNS narwhale +narwhals NNS narwhal +nary DT nary +nary JJ nary +nasal JJ nasal +nasal NN nasal +nasale VB nasale +nasale VBP nasale +nasalis NN nasalis +nasalisation NNN nasalisation +nasalisations NNS nasalisation +nasalise VB nasalise +nasalise VBP nasalise +nasalised VBD nasalise +nasalised VBN nasalise +nasalises VBZ nasalise +nasalising VBG nasalise +nasalism NNN nasalism +nasalisms NNS nasalism +nasalities NNS nasality +nasality NN nasality +nasalization NN nasalization +nasalizations NNS nasalization +nasalize VB nasalize +nasalize VBP nasalize +nasalized VBD nasalize +nasalized VBN nasalize +nasalizes VBZ nasalize +nasalizing VBG nasalize +nasally RB nasally +nasals NNS nasal +nasard NN nasard +nasards NNS nasard +nascence NN nascence +nascences NNS nascence +nascencies NNS nascency +nascency NN nascency +nascent JJ nascent +nasdaq NN nasdaq +naseberries NNS naseberry +naseberry NN naseberry +nashgab NN nashgab +nashgabs NNS nashgab +nasial JJ nasial +nasion NN nasion +nasions NNS nasion +nasofrontal JJ nasofrontal +nasogastric JJ nasogastric +nasolacrimal JJ nasolacrimal +nasological JJ nasological +nasologist NN nasologist +nasology NNN nasology +nasopalatine JJ nasopalatine +nasopharyngeal JJ nasopharyngeal +nasopharynx NN nasopharynx +nasopharynxes NNS nasopharynx +nasotracheal JJ nasotracheal +nastier JJR nasty +nasties NNS nasty +nastiest JJS nasty +nastily RB nastily +nastiness NN nastiness +nastinesses NNS nastiness +nasturtium NN nasturtium +nasturtiums NNS nasturtium +nasty JJ nasty +nasty NN nasty +nasua NN nasua +nasute NN nasute +nasuteness NN nasuteness +nasutes NNS nasute +nat NN nat +natal JJ natal +natalities NNS natality +natality NNN natality +natant JJ natant +natantia NN natantia +natation NNN natation +natational JJ natational +natations NNS natation +natator NN natator +natatorial JJ natatorial +natatorium NN natatorium +natatoriums NNS natatorium +natatory JJ natatory +natch JJ natch +natch NN natch +natch RB natch +natches NNS natch +naticidae NN naticidae +nation NN nation +nation-state NNN nation-state +national JJ national +national NN national +nationalisation NN nationalisation +nationalisations NNS nationalisation +nationalise VB nationalise +nationalise VBP nationalise +nationalised VBD nationalise +nationalised VBN nationalise +nationaliser NN nationaliser +nationalises VBZ nationalise +nationalising VBG nationalise +nationalism NN nationalism +nationalisms NNS nationalism +nationalist JJ nationalist +nationalist NN nationalist +nationalistic JJ nationalistic +nationalistically RB nationalistically +nationalists NNS nationalist +nationalities NNS nationality +nationality NNN nationality +nationalization NNN nationalization +nationalizations NNS nationalization +nationalize VB nationalize +nationalize VBP nationalize +nationalized VBD nationalize +nationalized VBN nationalize +nationalizer NN nationalizer +nationalizers NNS nationalizer +nationalizes VBZ nationalize +nationalizing VBG nationalize +nationally RB nationally +nationals NNS national +nationhood NN nationhood +nationhoods NNS nationhood +nationless JJ nationless +nations NNS nation +nationstate NNS nation-state +nationstates NNS nation-state +nationwide JJ nationwide +nationwide RB nationwide +native JJ native +native NN native +native-born JJ native-born +nativeborn JJ native-born +natively RB natively +nativeness NN nativeness +nativenesses NNS nativeness +natives NNS native +nativism NNN nativism +nativisms NNS nativism +nativist JJ nativist +nativist NN nativist +nativistic JJ nativistic +nativists NNS nativist +nativities NNS nativity +nativity NN nativity +natl NN natl +natrium NN natrium +natriums NNS natrium +natriureses NNS natriuresis +natriuresis NN natriuresis +natriuretic NN natriuretic +natriuretics NNS natriuretic +natrix NN natrix +natrolite NN natrolite +natrolites NNS natrolite +natron NN natron +natrons NNS natron +nats NNS nat +natter NN natter +natter VB natter +natter VBP natter +nattered VBD natter +nattered VBN natter +natterer NN natterer +natterers NNS natterer +nattering VBG natter +natterjack NN natterjack +natterjacks NNS natterjack +natters NNS natter +natters VBZ natter +nattier JJR natty +nattiest JJS natty +nattily RB nattily +nattiness NN nattiness +nattinesses NNS nattiness +natty JJ natty +natural JJ natural +natural NN natural +natural-born JJ natural-born +naturalisation NNN naturalisation +naturalisations NNS naturalization +naturalise VB naturalise +naturalise VBP naturalise +naturalised VBD naturalise +naturalised VBN naturalise +naturaliser NN naturaliser +naturalises VBZ naturalise +naturalising VBG naturalise +naturalism NN naturalism +naturalisms NNS naturalism +naturalist NN naturalist +naturalistic JJ naturalistic +naturalistically RB naturalistically +naturalists NNS naturalist +naturalization NN naturalization +naturalizations NNS naturalization +naturalize VB naturalize +naturalize VBP naturalize +naturalized VBD naturalize +naturalized VBN naturalize +naturalizer NN naturalizer +naturalizers NNS naturalizer +naturalizes VBZ naturalize +naturalizing VBG naturalize +naturally RB naturally +naturalness NN naturalness +naturalnesses NNS naturalness +naturals NNS natural +nature NNN nature +naturedly RB naturedly +naturelike JJ naturelike +natures NNS nature +naturism NNN naturism +naturisms NNS naturism +naturist NN naturist +naturistic JJ naturistic +naturists NNS naturist +naturopath NN naturopath +naturopathic JJ naturopathic +naturopathies NNS naturopathy +naturopaths NNS naturopath +naturopathy NN naturopathy +nauch NN nauch +nauclea NN nauclea +naucrates NN naucrates +naught NN naught +naughtier JJR naughty +naughties NNS naughty +naughtiest JJS naughty +naughtily RB naughtily +naughtiness NN naughtiness +naughtinesses NNS naughtiness +naughts NNS naught +naughty JJ naughty +naughty NN naughty +naumachia NN naumachia +naumachias NNS naumachia +naumachies NNS naumachy +naumachy NN naumachy +naunt NN naunt +naunts NNS naunt +naupathia NN naupathia +nauplial JJ nauplial +naupliform JJ naupliform +nauplii NNS nauplius +nauplioid JJ nauplioid +nauplius NN nauplius +nauran NN nauran +nausea NN nausea +nauseant NN nauseant +nauseants NNS nauseant +nauseas NNS nausea +nauseate VB nauseate +nauseate VBP nauseate +nauseated JJ nauseated +nauseated VBD nauseate +nauseated VBN nauseate +nauseates VBZ nauseate +nauseating JJ nauseating +nauseating VBG nauseate +nauseatingly RB nauseatingly +nauseatingness NN nauseatingness +nauseation NNN nauseation +nauseations NNS nauseation +nauseous JJ nauseous +nauseously RB nauseously +nauseousness NN nauseousness +nauseousnesses NNS nauseousness +naut NN naut +nautch NN nautch +nautches NNS nautch +nautic NN nautic +nautical JJ nautical +nauticality NNN nauticality +nautically RB nautically +nautics NNS nautic +nautili NNS nautilus +nautilidae NN nautilidae +nautiloid JJ nautiloid +nautiloid NN nautiloid +nautiloids NNS nautiloid +nautilus NN nautilus +nautiluses NNS nautilus +nav NN nav +navaid NN navaid +navaids NNS navaid +navajo NN navajo +naval JJ naval +navally RB navally +navar NN navar +navarch NN navarch +navarchies NNS navarchy +navarchs NNS navarch +navarchy NN navarchy +navarin NN navarin +navarins NNS navarin +navars NNS navar +nave NN nave +navel NN navel +navels NNS navel +navelwort NN navelwort +navelworts NNS navelwort +naves NNS nave +navette NN navette +navettes NNS navette +navew NN navew +navews NNS navew +navicert NN navicert +navicerts NNS navicert +navicula NN navicula +navicular JJ navicular +navicular NN navicular +naviculars NNS navicular +naviculas NNS navicula +navies NNS navy +navig NN navig +navigabilities NNS navigability +navigability NN navigability +navigable JJ navigable +navigableness NN navigableness +navigablenesses NNS navigableness +navigably RB navigably +navigate VB navigate +navigate VBP navigate +navigated VBD navigate +navigated VBN navigate +navigates VBZ navigate +navigating VBG navigate +navigation NN navigation +navigational JJ navigational +navigationally RB navigationally +navigations NNS navigation +navigator NN navigator +navigators NNS navigator +navvies NNS navvy +navvy NN navvy +navy JJ navy +navy NN navy +nawab NN nawab +nawabs NNS nawab +nawabship NN nawabship +nay JJ nay +nay NN nay +nays NNS nay +naysayer NN naysayer +naysayers NNS naysayer +naysaying NN naysaying +naze NN naze +nazes NNS naze +nazes NNS nazis +nazi NN nazi +nazification NNN nazification +nazifications NNS nazification +naziism NNN naziism +nazir NN nazir +nazirs NNS nazir +nazis NN nazis +nazis NNS nazi +nazism NNN nazism +naïvely RB naïvely +naïveness NNN naïveness +ne NN ne +neafe NN neafe +neafes NNS neafe +neaffe NN neaffe +neaffes NNS neaffe +neandertal JJ neandertal +neanderthal NN neanderthal +neanderthaler NN neanderthaler +neanderthalers NNS neanderthaler +neanderthalian JJ neanderthalian +neanderthals NNS neanderthal +neap JJ neap +neap NN neap +neaped JJ neaped +neaps NNS neap +neaptide NN neaptide +neaptides NNS neaptide +near IN near +near JJ near +near VB near +near VBP near +near-blind JJ near-blind +near-normal JJ near-normal +near-point NNN near-point +near-sighted JJ near-sighted +near-sightedly RB near-sightedly +near-sightedness NNN near-sightedness +nearby JJ nearby +nearby RB nearby +neared VBD near +neared VBN near +nearer JJR near +nearest IN nearest +nearest JJS near +nearing VBG near +nearlier JJR nearly +nearliest JJS nearly +nearly JJ nearly +nearly RB nearly +nearness NN nearness +nearnesses NNS nearness +nears VBZ near +nearside NN nearside +nearsides NNS nearside +nearsighted JJ nearsighted +nearsightedness NN nearsightedness +nearsightednesses NNS nearsightedness +neat JJ neat +neat NN neat +neaten VB neaten +neaten VBP neaten +neatened VBD neaten +neatened VBN neaten +neatening VBG neaten +neatens VBZ neaten +neater JJR neat +neatest JJS neat +neath IN neath +neatherd NN neatherd +neatherds NNS neatherd +neatly RB neatly +neatness NN neatness +neatnesses NNS neatness +neb NN neb +nebbich NN nebbich +nebbiches NNS nebbich +nebbish NN nebbish +nebbishe NN nebbishe +nebbisher NN nebbisher +nebbishers NNS nebbisher +nebbishes NNS nebbishe +nebbishes NNS nebbish +nebbuk NN nebbuk +nebbuks NNS nebbuk +nebeck NN nebeck +nebecks NNS nebeck +nebek NN nebek +nebeks NNS nebek +nebel NN nebel +nebels NNS nebel +nebenkern NN nebenkern +nebenkerns NNS nebenkern +nebish NN nebish +nebishes NNS nebish +nebraskan NN nebraskan +nebris NN nebris +nebrises NNS nebris +nebs NNS neb +nebuchadnezzar NN nebuchadnezzar +nebuchadnezzars NNS nebuchadnezzar +nebula NN nebula +nebulae NNS nebula +nebular JJ nebular +nebulas NNS nebula +nebulated JJ nebulated +nebule JJ nebule +nebule NN nebule +nebules NNS nebule +nebulisation NNN nebulisation +nebuliser NN nebuliser +nebulisers NNS nebuliser +nebulization NNN nebulization +nebulizations NNS nebulization +nebulizer NN nebulizer +nebulizers NNS nebulizer +nebulose JJ nebulose +nebulosities NNS nebulosity +nebulosity NNN nebulosity +nebulosus JJ nebulosus +nebulous JJ nebulous +nebulously RB nebulously +nebulousness NN nebulousness +nebulousnesses NNS nebulousness +nebuly RB nebuly +necessarian JJ necessarian +necessarian NN necessarian +necessarianism NNN necessarianism +necessarians NNS necessarian +necessaries NNS necessary +necessarily RB necessarily +necessariness NN necessariness +necessary JJ necessary +necessary NN necessary +necessitarian NN necessitarian +necessitarianism NNN necessitarianism +necessitarianisms NNS necessitarianism +necessitarians NNS necessitarian +necessitate VB necessitate +necessitate VBP necessitate +necessitated VBD necessitate +necessitated VBN necessitate +necessitates VBZ necessitate +necessitating VBG necessitate +necessitation NNN necessitation +necessitations NNS necessitation +necessitative JJ necessitative +necessities NNS necessity +necessitous JJ necessitous +necessitously RB necessitously +necessitousness NN necessitousness +necessitousnesses NNS necessitousness +necessitude NN necessitude +necessity NNN necessity +neck NN neck +neck VB neck +neck VBP neck +neckband NN neckband +neckbands NNS neckband +neckcloth NN neckcloth +neckcloths NNS neckcloth +necked JJ necked +necked VBD neck +necked VBN neck +necker NN necker +neckerchief NN neckerchief +neckerchiefs NNS neckerchief +neckerchieves NNS neckerchief +neckers NNS necker +necking NN necking +necking VBG neck +neckings NNS necking +necklace NN necklace +necklace VB necklace +necklace VBP necklace +necklaced VBD necklace +necklaced VBN necklace +necklaces NNS necklace +necklaces VBZ necklace +necklacing VBG necklace +neckless JJ neckless +necklet NN necklet +necklets NNS necklet +necklike JJ necklike +neckline NN neckline +necklines NNS neckline +neckpiece NN neckpiece +neckpieces NNS neckpiece +necks NNS neck +necks VBZ neck +necktie NN necktie +necktieless JJ necktieless +neckties NNS necktie +neckwear NN neckwear +neckweed NN neckweed +neckweeds NNS neckweed +necremia NN necremia +necro NN necro +necrobacillosis NN necrobacillosis +necrobioses NNS necrobiosis +necrobiosis NN necrobiosis +necrographer NN necrographer +necrographers NNS necrographer +necrolatries NNS necrolatry +necrolatry NN necrolatry +necrologic JJ necrologic +necrological JJ necrological +necrologically RB necrologically +necrologies NNS necrology +necrologist NN necrologist +necrologists NNS necrologist +necrology NN necrology +necrolysis NN necrolysis +necromancer NN necromancer +necromancers NNS necromancer +necromancies NNS necromancy +necromancy NN necromancy +necromania NN necromania +necromantic JJ necromantic +necromantical JJ necromantical +necromantically RB necromantically +necromimesis NN necromimesis +necrophagia NN necrophagia +necrophagias NNS necrophagia +necrophagy NN necrophagy +necrophile NN necrophile +necrophiles NNS necrophile +necrophilia NN necrophilia +necrophiliac JJ necrophiliac +necrophiliac NN necrophiliac +necrophiliacs NNS necrophiliac +necrophilias NNS necrophilia +necrophilic JJ necrophilic +necrophilic NN necrophilic +necrophilism NNN necrophilism +necrophilisms NNS necrophilism +necrophobia NN necrophobia +necrophobias NNS necrophobia +necrophobic JJ necrophobic +necropoleis NNS necropolis +necropoles NNS necropolis +necropoli NN necropoli +necropoli NNS necropolis +necropolis NN necropolis +necropolis NNS necropoli +necropolises NNS necropolis +necropolitan JJ necropolitan +necropsies NNS necropsy +necropsy NN necropsy +necroscopies NNS necroscopy +necroscopy NN necroscopy +necrose VB necrose +necrose VBP necrose +necrosed VBD necrose +necrosed VBN necrose +necroses VBZ necrose +necroses NNS necrosis +necrosing VBG necrose +necrosis NN necrosis +necrotic JJ necrotic +necrotomic JJ necrotomic +necrotomies NNS necrotomy +necrotomist NN necrotomist +necrotomy NN necrotomy +nectar NN nectar +nectareous JJ nectareous +nectareously RB nectareously +nectareousness NN nectareousness +nectaries NNS nectary +nectariferous JJ nectariferous +nectarine NN nectarine +nectarines NNS nectarine +nectarous JJ nectarous +nectars NNS nectar +nectary NN nectary +nectocalyces NNS nectocalyx +nectocalyx NN nectocalyx +necturus NN necturus +ned NN ned +neddies NNS neddy +neddy NN neddy +neds NNS ned +nee JJ nee +need MD need +need NNN need +need VB need +need VBP need +needed JJ needed +needed VBD need +needed VBN need +needer NN needer +needers NNS needer +needfire NN needfire +needful JJ needful +needful NN needful +needfully RB needfully +needfulness NN needfulness +needfulnesses NNS needfulness +needfuls NNS needful +needier JJR needy +neediest JJS needy +needily RB needily +neediness NN neediness +needinesses NNS neediness +needing VBG need +needle NN needle +needle VB needle +needle VBP needle +needle-shaped JJ needle-shaped +needlebush NN needlebush +needlecord NN needlecord +needlecords NNS needlecord +needlecraft NN needlecraft +needlecrafts NNS needlecraft +needled VBD needle +needled VBN needle +needlefish NN needlefish +needlefish NNS needlefish +needleful NN needleful +needlefuls NNS needleful +needleless JJ needleless +needlelike JJ needlelike +needlepoint NN needlepoint +needlepoints NNS needlepoint +needler NN needler +needlers NNS needler +needles NNS needle +needles VBZ needle +needless JJ needless +needlessly RB needlessly +needlessness NN needlessness +needlessnesses NNS needlessness +needlewoman NN needlewoman +needlewomen NNS needlewoman +needlewood NN needlewood +needlework NN needlework +needleworker NN needleworker +needleworkers NNS needleworker +needleworks NNS needlework +needling NNN needling +needling NNS needling +needling VBG needle +needn MD need +needs RB needs +needs NNS need +needs VBZ need +needy JJ needy +neem NN neem +neems NNS neem +neencephalon NN neencephalon +neep NN neep +neeps NNS neep +nef NN nef +nefarious JJ nefarious +nefariously RB nefariously +nefariousness NN nefariousness +nefariousnesses NNS nefariousness +nefs NNS nef +neg NN neg +negaprion NN negaprion +negate VB negate +negate VBP negate +negated VBD negate +negated VBN negate +negatedness NN negatedness +negater NN negater +negaters NNS negater +negates VBZ negate +negating NNN negating +negating VBG negate +negation NNN negation +negational JJ negational +negationist NN negationist +negationists NNS negationist +negations NNS negation +negative JJ negative +negative NNN negative +negative VB negative +negative VBG negative +negative VBP negative +negative-raising NNN negative-raising +negatived VBD negative +negatived VBN negative +negatively RB negatively +negativeness NN negativeness +negativenesses NNS negativeness +negatives NNS negative +negatives VBZ negative +negativing VBG negative +negativism NN negativism +negativisms NNS negativism +negativist NN negativist +negativists NNS negativist +negativities NNS negativity +negativity NN negativity +negaton NN negaton +negatons NNS negaton +negator NN negator +negators NNS negator +negatron NN negatron +negatrons NNS negatron +neglect NN neglect +neglect VB neglect +neglect VBP neglect +neglected JJ neglected +neglected VBD neglect +neglected VBN neglect +neglectedly RB neglectedly +neglectedness NN neglectedness +neglecter NN neglecter +neglecters NNS neglecter +neglectful JJ neglectful +neglectfully RB neglectfully +neglectfulness NN neglectfulness +neglectfulnesses NNS neglectfulness +neglecting VBG neglect +neglectingly RB neglectingly +neglection NNN neglection +neglections NNS neglection +neglector NN neglector +neglectors NNS neglector +neglects NNS neglect +neglects VBZ neglect +neglige NN neglige +negligee NNN negligee +negligees NNS negligee +negligence NN negligence +negligences NNS negligence +negligent JJ negligent +negligently RB negligently +negliges NNS neglige +negligibilities NNS negligibility +negligibility NNN negligibility +negligible JJ negligible +negligibleness NN negligibleness +negligiblenesses NNS negligibleness +negligibly RB negligibly +negociant NN negociant +negociants NNS negociant +negociate VB negociate +negociate VBP negociate +negotiabilities NNS negotiability +negotiability NN negotiability +negotiable JJ negotiable +negotiable NN negotiable +negotiables NNS negotiable +negotiant NN negotiant +negotiants NNS negotiant +negotiate VB negotiate +negotiate VBP negotiate +negotiated VBD negotiate +negotiated VBN negotiate +negotiates VBZ negotiate +negotiating VBG negotiate +negotiation NNN negotiation +negotiations NNS negotiation +negotiator NN negotiator +negotiators NNS negotiator +negotiatress NN negotiatress +negotiatresses NNS negotiatress +negotiatrix NN negotiatrix +negotiatrixes NNS negotiatrix +negritude NN negritude +negritudes NNS negritude +negro JJ negro +negroid JJ negroid +negroid NN negroid +negroids NNS negroid +negroism NNN negroism +negroisms NNS negroism +negroni NN negroni +negronis NNS negroni +negrophil NN negrophil +negrophile NN negrophile +negrophiles NNS negrophile +negrophilism NNN negrophilism +negrophilisms NNS negrophilism +negrophilist NN negrophilist +negrophilists NNS negrophilist +negrophils NNS negrophil +negrophobe NN negrophobe +negrophobes NNS negrophobe +negrophobia NN negrophobia +negrophobias NNS negrophobia +negs NNS neg +negus NN negus +neguses NNS negus +neif NN neif +neifs NNS neif +neigh NN neigh +neigh VB neigh +neigh VBP neigh +neighbor JJ neighbor +neighbor NN neighbor +neighbor VB neighbor +neighbor VBP neighbor +neighbored VBD neighbor +neighbored VBN neighbor +neighborhood NNN neighborhood +neighborhoods NNS neighborhood +neighboring JJ neighboring +neighboring VBG neighbor +neighborless JJ neighborless +neighborliness NN neighborliness +neighborlinesses NNS neighborliness +neighborly RB neighborly +neighbors NNS neighbor +neighbors VBZ neighbor +neighbour JJ neighbour +neighbour NN neighbour +neighbour VB neighbour +neighbour VBP neighbour +neighboured VBD neighbour +neighboured VBN neighbour +neighbourhood NN neighbourhood +neighbourhoods NNS neighbourhood +neighbouring JJ neighbouring +neighbouring VBG neighbour +neighbourless JJ neighbourless +neighbourliness NN neighbourliness +neighbourly RB neighbourly +neighbours NNS neighbour +neighbours VBZ neighbour +neighed VBD neigh +neighed VBN neigh +neighing VBG neigh +neighs NNS neigh +neighs VBZ neigh +neisseria NN neisseria +neither CC neither +neither DT neither +neive NN neive +neives NNS neive +neives NNS neif +nek NN nek +nekton NN nekton +nektonic JJ nektonic +nektons NNS nekton +nellie NN nellie +nellies NNS nellie +nellies NNS nelly +nelly NN nelly +nelson NN nelson +nelsons NNS nelson +nelumbian JJ nelumbian +nelumbium NN nelumbium +nelumbiums NNS nelumbium +nelumbo NN nelumbo +nelumbonaceae NN nelumbonaceae +nelumbos NNS nelumbo +nema NN nema +nemas NNS nema +nemathecial JJ nemathecial +nemathecium NN nemathecium +nemathelminth NN nemathelminth +nemathelminths NNS nemathelminth +nematic JJ nematic +nematicide NN nematicide +nematicides NNS nematicide +nematocera NN nematocera +nematocide NN nematocide +nematocides NNS nematocide +nematocyst NN nematocyst +nematocystic JJ nematocystic +nematocysts NNS nematocyst +nematode NN nematode +nematodes NNS nematode +nematological JJ nematological +nematologies NNS nematology +nematologist NN nematologist +nematologists NNS nematologist +nematology NNN nematology +nemertean JJ nemertean +nemertean NN nemertean +nemerteans NNS nemertean +nemertina NN nemertina +nemertine NN nemertine +nemertines NNS nemertine +nemeses NNS nemesis +nemesia NN nemesia +nemesias NNS nemesia +nemesis NN nemesis +nemo NN nemo +nemophila NN nemophila +nemophilas NNS nemophila +nemoricole JJ nemoricole +nene NN nene +nenes NNS nene +nenets NN nenets +nentsi NN nentsi +nentsy NN nentsy +nenuphar NN nenuphar +nenuphars NNS nenuphar +neo JJ neo +neo-Plastic JJ neo-Plastic +neo-classicist NN neo-classicist +neo-orthodoxy NN neo-orthodoxy +neoanthropic JJ neoanthropic +neoarsphenamine NN neoarsphenamine +neoarsphenamines NNS neoarsphenamine +neoblast NN neoblast +neoblasts NNS neoblast +neoceratodus NN neoceratodus +neoclassic JJ neoclassic +neoclassic NN neoclassic +neoclassical JJ neoclassical +neoclassicism NN neoclassicism +neoclassicisms NNS neoclassicism +neoclassicist JJ neoclassicist +neoclassicist NN neoclassicist +neoclassicistic JJ neoclassicistic +neoclassicists NNS neoclassicist +neocolonial JJ neocolonial +neocolonialism NN neocolonialism +neocolonialisms NNS neocolonialism +neocolonialist NN neocolonialist +neocolonialists NNS neocolonialist +neocon NN neocon +neocons NNS neocon +neoconservatism NNN neoconservatism +neoconservatisms NNS neoconservatism +neoconservative NN neoconservative +neoconservatives NNS neoconservative +neocortex NN neocortex +neocortexes NNS neocortex +neocortical JJ neocortical +neocortices NNS neocortex +neodymium NN neodymium +neodymiums NNS neodymium +neoencephalon NN neoencephalon +neoexpressionism NNN neoexpressionism +neofascism NNN neofascism +neofascisms NNS neofascism +neofascist NN neofascist +neofascists NNS neofascist +neofiber NN neofiber +neoformation NNN neoformation +neoformative JJ neoformative +neogeneses NNS neogenesis +neogenesis NN neogenesis +neogrammarian NN neogrammarian +neogrammarians NNS neogrammarian +neohygrophorus NN neohygrophorus +neoimperialism NNN neoimperialism +neoimpressionism NNN neoimpressionism +neoimpressionisms NNS neoimpressionism +neoimpressionist NN neoimpressionist +neoimpressionists NNS neoimpressionist +neolentinus NN neolentinus +neoliberal JJ neoliberal +neoliberal NN neoliberal +neoliberalism NNN neoliberalism +neoliberalisms NNS neoliberalism +neoliberals NNS neoliberal +neolith NN neolith +neoliths NNS neolith +neologian NN neologian +neologians NNS neologian +neologic JJ neologic +neological JJ neological +neologically RB neologically +neologies NNS neology +neologism NNN neologism +neologisms NNS neologism +neologist NN neologist +neologistic JJ neologistic +neologistical JJ neologistical +neologists NNS neologist +neology NNN neology +neomorph NN neomorph +neomorphs NNS neomorph +neomycin NN neomycin +neomycins NNS neomycin +neomys NN neomys +neon NN neon +neonatal JJ neonatal +neonatally RB neonatally +neonate NN neonate +neonates NNS neonate +neonatologies NNS neonatology +neonatologist NN neonatologist +neonatologists NNS neonatologist +neonatology NNN neonatology +neonomian NN neonomian +neonomians NNS neonomian +neons NNS neon +neoorthodox JJ neoorthodox +neoorthodoxies NNS neoorthodoxy +neoorthodoxy NN neoorthodoxy +neopagan NN neopagan +neopagans NNS neopagan +neopallium NN neopallium +neophile NN neophile +neophiles NNS neophile +neophilia NN neophilia +neophiliac NN neophiliac +neophiliacs NNS neophiliac +neophilias NNS neophilia +neophron NN neophron +neophyte NN neophyte +neophytes NNS neophyte +neophytic JJ neophytic +neophytism NNN neophytism +neoplasia NN neoplasia +neoplasias NNS neoplasia +neoplasm NN neoplasm +neoplasms NNS neoplasm +neoplasticism NNN neoplasticism +neoplasticisms NNS neoplasticism +neoplasticist NN neoplasticist +neoplasticists NNS neoplasticist +neoplasties NNS neoplasty +neoplasty NNN neoplasty +neoplatonist NN neoplatonist +neoplatonists NNS neoplatonist +neopolitan NN neopolitan +neoprene NN neoprene +neoprenes NNS neoprene +neorealism NNN neorealism +neorealisms NNS neorealism +neorealist NN neorealist +neorealists NNS neorealist +neoromantic JJ neoromantic +neoromanticism NNN neoromanticism +neostigmine NN neostigmine +neostigmines NNS neostigmine +neotenies NNS neoteny +neotenous JJ neotenous +neoteny NN neoteny +neoteric JJ neoteric +neoteric NN neoteric +neoterics NNS neoteric +neoterism NNN neoterism +neoterist NN neoterist +neoterists NNS neoterist +neoterminal JJ neoterminal +neotoma NN neotoma +neotraditional JJ neotraditional +neotropical JJ neotropical +neotype NN neotype +neotypes NNS neotype +neourthodox JJ neourthodox +neovascularisation NNN neovascularisation +neoytterbium NN neoytterbium +nep NN nep +nepa NN nepa +nepenthaceae NN nepenthaceae +nepenthe NN nepenthe +nepenthean JJ nepenthean +nepenthes NNS nepenthe +neper NN neper +nepers NNS neper +nepeta NN nepeta +nephalist NN nephalist +nephalists NNS nephalist +nepheline NN nepheline +nephelines NNS nepheline +nephelinite NN nephelinite +nephelinites NNS nephelinite +nephelinitic JJ nephelinitic +nephelite NN nephelite +nephelites NNS nephelite +nephelium NN nephelium +nephelometer NN nephelometer +nephelometers NNS nephelometer +nephelometries NNS nephelometry +nephelometry NN nephelometry +nephew NN nephew +nephews NNS nephew +nephogram NN nephogram +nephograms NNS nephogram +nephograph NN nephograph +nephographs NNS nephograph +nephological JJ nephological +nephologies NNS nephology +nephologist NN nephologist +nephologists NNS nephologist +nephology NNN nephology +nephoscope NN nephoscope +nephoscopes NNS nephoscope +nephralgia NN nephralgia +nephralgias NNS nephralgia +nephralgic JJ nephralgic +nephrectomies NNS nephrectomy +nephrectomy NN nephrectomy +nephric JJ nephric +nephridial JJ nephridial +nephridium NN nephridium +nephridiums NNS nephridium +nephrism NNN nephrism +nephrisms NNS nephrism +nephrite NN nephrite +nephrites NNS nephrite +nephritic JJ nephritic +nephritides NNS nephritis +nephritis NN nephritis +nephritises NNS nephritis +nephrocalcinosis NN nephrocalcinosis +nephrocele NN nephrocele +nephrogenous JJ nephrogenous +nephrolepis NN nephrolepis +nephrolith NN nephrolith +nephrolithiasis NN nephrolithiasis +nephrolithic JJ nephrolithic +nephrolithotomy NN nephrolithotomy +nephrologies NNS nephrology +nephrologist NN nephrologist +nephrologists NNS nephrologist +nephrology NNN nephrology +nephron NN nephron +nephrons NNS nephron +nephropathic JJ nephropathic +nephropathies NNS nephropathy +nephropathy NN nephropathy +nephrops NN nephrops +nephropsidae NN nephropsidae +nephroses NNS nephrosis +nephrosis NN nephrosis +nephrostome NN nephrostome +nephrostomes NNS nephrostome +nephrostomial JJ nephrostomial +nephrostomous JJ nephrostomous +nephrotic JJ nephrotic +nephrotic NN nephrotic +nephrotics NNS nephrotic +nephrotome NN nephrotome +nephrotomies NNS nephrotomy +nephrotomise NN nephrotomise +nephrotomy NN nephrotomy +nephrotoxic JJ nephrotoxic +nephrotoxicities NNS nephrotoxicity +nephrotoxicity NN nephrotoxicity +nephthys NN nephthys +nephthytis NN nephthytis +nepidae NN nepidae +nepit NN nepit +nepits NNS nepit +nepman NN nepman +nepotic JJ nepotic +nepotism NN nepotism +nepotisms NNS nepotism +nepotist NN nepotist +nepotistic JJ nepotistic +nepotistical JJ nepotistical +nepotists NNS nepotist +neps NNS nep +neptunium NN neptunium +neptuniums NNS neptunium +neral NN neral +nerals NNS neral +nerd NN nerd +nerdier JJR nerdy +nerdiest JJS nerdy +nerdiness NN nerdiness +nerds NNS nerd +nerdy JJ nerdy +nereid NN nereid +nereides NNS nereid +nereids NNS nereid +nereis NN nereis +nereises NNS nereis +nergal NN nergal +nerine NN nerine +nerines NNS nerine +nerita NN nerita +neritic JJ neritic +neritid NN neritid +neritidae NN neritidae +neritina NN neritina +nerium NN nerium +nerk NN nerk +nerka NN nerka +nerkas NNS nerka +nerks NNS nerk +nerodia NN nerodia +nerol NN nerol +neroli NN neroli +nerolis NNS neroli +nerols NNS nerol +nerthus NN nerthus +nerts UH nerts +nervate JJ nervate +nervation NNN nervation +nervations NNS nervation +nervature NN nervature +nervatures NNS nervature +nerve NNN nerve +nerve VB nerve +nerve VBP nerve +nerve-racking JJ nerve-racking +nerve-wracking JJ nerve-wracking +nerved VBD nerve +nerved VBN nerve +nerveless JJ nerveless +nervelessly RB nervelessly +nervelessness NN nervelessness +nervelessnesses NNS nervelessness +nervelet NN nervelet +nervelets NNS nervelet +nerver NN nerver +nerveroot NN nerveroot +nervers NNS nerver +nerves NNS nerve +nerves VBZ nerve +nervi NN nervi +nervier JJR nervy +nerviest JJS nervy +nervily RB nervily +nervine JJ nervine +nervine NN nervine +nervines NN nervines +nervines NNS nervine +nerviness NN nerviness +nervinesses NNS nerviness +nervinesses NNS nervines +nerving NNN nerving +nerving VBG nerve +nervings NNS nerving +nervosities NNS nervosity +nervosity NNN nervosity +nervous JJ nervous +nervously RB nervously +nervousness NN nervousness +nervousnesses NNS nervousness +nervule NN nervule +nervules NNS nervule +nervuration NNN nervuration +nervurations NNS nervuration +nervure NN nervure +nervures NNS nervure +nervus NN nervus +nervy JJ nervy +nescience NN nescience +nesciences NNS nescience +nescient JJ nescient +nescient NN nescient +nescients NNS nescient +nesh JJ nesh +nesokia NN nesokia +nesosilicate NN nesosilicate +ness NN ness +nesses NNS ness +nest NN nest +nest VB nest +nest VBP nest +nestable JJ nestable +nested VBD nest +nested VBN nest +nester NN nester +nesters NNS nester +nesting VBG nest +nestle NN nestle +nestle VB nestle +nestle VBP nestle +nestled JJ nestled +nestled VBD nestle +nestled VBN nestle +nestler NN nestler +nestlers NNS nestler +nestles NNS nestle +nestles VBZ nestle +nestlike JJ nestlike +nestling NNN nestling +nestling NNS nestling +nestling VBG nestle +nestlings NNS nestling +nestor NN nestor +nestors NNS nestor +nests NNS nest +nests VBZ nest +nesty JJ nesty +net JJ net +net NNN net +net VB net +net VBP net +netback NN netback +netbacks NNS netback +netball NN netball +nete NN nete +netes NNS nete +netful NN netful +netfuls NNS netful +nether JJ nether +nethermost DT nethermost +netherstock NN netherstock +netherstocks NNS netherstock +netherward JJ netherward +netherward NN netherward +netherwards NNS netherward +netherworld NN netherworld +netherworlds NNS netherworld +netiquette NN netiquette +netiquettes NNS netiquette +netizen NN netizen +netizens NNS netizen +netkeeper NN netkeeper +netless JJ netless +netlike JJ netlike +netmail VB netmail +netmail VBP netmail +netman NN netman +netminder NN netminder +netminders NNS netminder +netop NN netop +netops NNS netop +nets NNS net +nets VBZ net +netscape NN netscape +netsuke NN netsuke +netsukes NNS netsuke +nett JJ nett +nettable JJ nettable +netted VBD net +netted VBN net +netter NN netter +netter JJR nett +netter JJR net +netters NNS netter +nettier JJR netty +nettiest JJS netty +netting NN netting +netting VBG net +nettings NNS netting +nettle NN nettle +nettle VB nettle +nettle VBP nettle +nettled VBD nettle +nettled VBN nettle +nettlefish NN nettlefish +nettlefish NNS nettlefish +nettlelike JJ nettlelike +nettler NN nettler +nettlers NNS nettler +nettles NNS nettle +nettles VBZ nettle +nettlesome JJ nettlesome +nettlier JJR nettly +nettliest JJS nettly +nettling NNN nettling +nettling NNS nettling +nettling VBG nettle +nettly RB nettly +netty JJ netty +network NN network +network VB network +network VBP network +networkable JJ networkable +networked VBD network +networked VBN network +networker NN networker +networkers NNS networker +networking NN networking +networking VBG network +networkings NNS networking +networklike JJ networklike +networks NNS network +networks VBZ network +networkwide JJ networkwide +neuk NN neuk +neuks NNS neuk +neum NN neum +neumatic JJ neumatic +neume NN neume +neumes NNS neume +neumic JJ neumic +neums NNS neum +neural JJ neural +neuralgia NN neuralgia +neuralgias NNS neuralgia +neuralgic JJ neuralgic +neuralgy NN neuralgy +neurally RB neurally +neuraminidase NN neuraminidase +neuraminidases NNS neuraminidase +neurasthenia NN neurasthenia +neurasthenias NNS neurasthenia +neurasthenic JJ neurasthenic +neurasthenic NN neurasthenic +neurasthenically RB neurasthenically +neurasthenics NNS neurasthenic +neuration NNN neuration +neurations NNS neuration +neuraxitis NN neuraxitis +neuraxon NN neuraxon +neuraxons NNS neuraxon +neurectomies NNS neurectomy +neurectomy NN neurectomy +neurilemma NN neurilemma +neurilemmal JJ neurilemmal +neurilemmas NNS neurilemma +neurilemmatic JJ neurilemmatic +neurine NN neurine +neurines NNS neurine +neurite NN neurite +neuritic JJ neuritic +neuritic NN neuritic +neuritics NNS neuritic +neuritides NNS neuritis +neuritis NN neuritis +neuritises NNS neuritis +neuroanatomic JJ neuroanatomic +neuroanatomical JJ neuroanatomical +neuroanatomies NNS neuroanatomy +neuroanatomist NN neuroanatomist +neuroanatomists NNS neuroanatomist +neuroanatomy NN neuroanatomy +neurobehavioural JJ neurobehavioural +neurobiological JJ neurobiological +neurobiologies NNS neurobiology +neurobiologist NN neurobiologist +neurobiologists NNS neurobiologist +neurobiology NNN neurobiology +neuroblast NN neuroblast +neuroblastic JJ neuroblastic +neuroblastoma NN neuroblastoma +neuroblastomas NNS neuroblastoma +neuroblasts NNS neuroblast +neurocelian JJ neurocelian +neurochemical NN neurochemical +neurochemicals NNS neurochemical +neurochemist NN neurochemist +neurochemistries NNS neurochemistry +neurochemistry NN neurochemistry +neurochemists NNS neurochemist +neurochip NN neurochip +neurochips NNS neurochip +neurocoele NN neurocoele +neurocoelian JJ neurocoelian +neurocomputer NN neurocomputer +neurocomputers NNS neurocomputer +neurodegeneration NNN neurodegeneration +neurodegenerative JJ neurodegenerative +neurodevelopment NN neurodevelopment +neurodevelopmental JJ neurodevelopmental +neuroembryological NN neuroembryological +neuroembryology NNN neuroembryology +neuroendocrine JJ neuroendocrine +neuroendocrinologies NNS neuroendocrinology +neuroendocrinologist NN neuroendocrinologist +neuroendocrinologists NNS neuroendocrinologist +neuroendocrinology NNN neuroendocrinology +neurofibril NN neurofibril +neurofibrils NNS neurofibril +neurofibroma NN neurofibroma +neurofibromas NNS neurofibroma +neurofibromatoses NNS neurofibromatosis +neurofibromatosis NN neurofibromatosis +neurogeneses NNS neurogenesis +neurogenesis NN neurogenesis +neurogenetic NN neurogenetic +neurogenetics NNS neurogenetic +neurogenic JJ neurogenic +neuroglia NN neuroglia +neurogliac JJ neurogliac +neurogliacyte NN neurogliacyte +neuroglial JJ neuroglial +neurogliar JJ neurogliar +neuroglias NNS neuroglia +neuroglic JJ neuroglic +neuroglycopenic JJ neuroglycopenic +neurogram NN neurogram +neurogrammic JJ neurogrammic +neurograms NNS neurogram +neurohormone NN neurohormone +neurohormones NNS neurohormone +neurohumor NN neurohumor +neurohumoral JJ neurohumoral +neurohumors NNS neurohumor +neurohypophyses NNS neurohypophysis +neurohypophysis NN neurohypophysis +neurohypophysises NNS neurohypophysis +neurolemma NN neurolemma +neurolemmas NNS neurolemma +neuroleptic NN neuroleptic +neuroleptics NNS neuroleptic +neurolinguist NN neurolinguist +neurolinguistic NN neurolinguistic +neurolinguistics NNS neurolinguistic +neurolinguists NNS neurolinguist +neurologic JJ neurologic +neurological JJ neurological +neurologically RB neurologically +neurologies NNS neurology +neurologist NN neurologist +neurologists NNS neurologist +neurology NN neurology +neurolytic JJ neurolytic +neuroma NN neuroma +neuromas NNS neuroma +neuromast NN neuromast +neuromastic JJ neuromastic +neuromasts NNS neuromast +neuromatous JJ neuromatous +neuromotor JJ neuromotor +neuromuscular JJ neuromuscular +neuron JJ neuron +neuron NN neuron +neuronal JJ neuronal +neurone NN neurone +neurones NNS neurone +neuronic JJ neuronic +neurons NNS neuron +neuropath NN neuropath +neuropathic JJ neuropathic +neuropathically RB neuropathically +neuropathies NNS neuropathy +neuropathist NN neuropathist +neuropathists NNS neuropathist +neuropathological JJ neuropathological +neuropathologically RB neuropathologically +neuropathologies NNS neuropathology +neuropathologist NN neuropathologist +neuropathologists NNS neuropathologist +neuropathology NNN neuropathology +neuropaths NNS neuropath +neuropathy NN neuropathy +neuropeptide NN neuropeptide +neuropeptides NNS neuropeptide +neuropharmacological JJ neuropharmacological +neuropharmacologies NNS neuropharmacology +neuropharmacologist NN neuropharmacologist +neuropharmacologists NNS neuropharmacologist +neuropharmacology NNN neuropharmacology +neurophysiologic JJ neurophysiologic +neurophysiological JJ neurophysiological +neurophysiologically RB neurophysiologically +neurophysiologies NNS neurophysiology +neurophysiologist NN neurophysiologist +neurophysiologists NNS neurophysiologist +neurophysiology NNN neurophysiology +neuroplasm NN neuroplasm +neuroplasmatic JJ neuroplasmatic +neuroplasmic JJ neuroplasmic +neuroprotective JJ neuroprotective +neuropsychiatric JJ neuropsychiatric +neuropsychiatries NNS neuropsychiatry +neuropsychiatrist NN neuropsychiatrist +neuropsychiatrists NNS neuropsychiatrist +neuropsychiatry NN neuropsychiatry +neuropsychological JJ neuropsychological +neuropsychologies NNS neuropsychology +neuropsychologist NN neuropsychologist +neuropsychologists NNS neuropsychologist +neuropsychology NNN neuropsychology +neuropsychopharmacology NNN neuropsychopharmacology +neuroptera NN neuroptera +neuropteran NN neuropteran +neuropterans NNS neuropteran +neuropterist NN neuropterist +neuropterists NNS neuropterist +neuropteron NN neuropteron +neuropterous JJ neuropterous +neuroradiological JJ neuroradiological +neuroradiologies NNS neuroradiology +neuroradiologist NN neuroradiologist +neuroradiologists NNS neuroradiologist +neuroradiology NNN neuroradiology +neurosarcoma NN neurosarcoma +neuroscience NN neuroscience +neurosciences NNS neuroscience +neuroscientific JJ neuroscientific +neuroscientist NN neuroscientist +neuroscientists NNS neuroscientist +neurosecretion NNN neurosecretion +neurosecretions NNS neurosecretion +neuroses NNS neurosis +neurosis NN neurosis +neurospora NN neurospora +neurosporas NNS neurospora +neurosurgeon NN neurosurgeon +neurosurgeons NNS neurosurgeon +neurosurgeries NNS neurosurgery +neurosurgery NN neurosurgery +neurosurgical JJ neurosurgical +neurosyphilis NN neurosyphilis +neurotic JJ neurotic +neurotic NN neurotic +neurotically RB neurotically +neuroticism NNN neuroticism +neuroticisms NNS neuroticism +neurotics NNS neurotic +neurotomies NNS neurotomy +neurotomy NN neurotomy +neurotoxic JJ neurotoxic +neurotoxicities NNS neurotoxicity +neurotoxicity NN neurotoxicity +neurotoxicology NNN neurotoxicology +neurotoxin NN neurotoxin +neurotoxins NNS neurotoxin +neurotransmission NN neurotransmission +neurotransmissions NNS neurotransmission +neurotransmitter NN neurotransmitter +neurotransmitters NNS neurotransmitter +neurotrichus NN neurotrichus +neurotrophic JJ neurotrophic +neurotrophy NN neurotrophy +neurotropic JJ neurotropic +neurotropism NNN neurotropism +neurotropisms NNS neurotropism +neurovascular JJ neurovascular +neurula NN neurula +neurulas NNS neurula +neurulation NNN neurulation +neurulations NNS neurulation +neustic JJ neustic +neuston NN neuston +neustonic JJ neustonic +neustons NNS neuston +neut NN neut +neuter JJ neuter +neuter NNN neuter +neuter VB neuter +neuter VBG neuter +neuter VBP neuter +neutered JJ neutered +neutered VBD neuter +neutered VBN neuter +neutering NNN neutering +neutering VBG neuter +neuters NNS neuter +neuters VBZ neuter +neutral JJ neutral +neutral NN neutral +neutralisation NNN neutralisation +neutralise NN neutralise +neutralise VB neutralise +neutralise VBP neutralise +neutralised VBD neutralise +neutralised VBN neutralise +neutraliser NN neutraliser +neutralisers NNS neutraliser +neutralises VBZ neutralise +neutralising VBG neutralise +neutralism NN neutralism +neutralisms NNS neutralism +neutralist NN neutralist +neutralists NNS neutralist +neutralities NNS neutrality +neutrality NN neutrality +neutralization NN neutralization +neutralizations NNS neutralization +neutralize VB neutralize +neutralize VBP neutralize +neutralized VBD neutralize +neutralized VBN neutralize +neutralizer NN neutralizer +neutralizers NNS neutralizer +neutralizes VBZ neutralize +neutralizing VBG neutralize +neutrally RB neutrally +neutralness NN neutralness +neutralnesses NNS neutralness +neutrals NNS neutral +neutretto NN neutretto +neutrettos NNS neutretto +neutrino NN neutrino +neutrinoless JJ neutrinoless +neutrinos NNS neutrino +neutron NN neutron +neutrons NNS neutron +neutropenia NN neutropenia +neutropenic JJ neutropenic +neutrophil JJ neutrophil +neutrophil NN neutrophil +neutrophile NN neutrophile +neutrophiles NNS neutrophile +neutrophilic JJ neutrophilic +neutrophils NNS neutrophil +neutrosphere NN neutrosphere +nevadan NN nevadan +neve NN neve +nevelling NN nevelling +nevelling NNS nevelling +never RB never +never UH never +never-ending JJ never-ending +never-never JJ never-never +never-never NN never-never +never-say-die JJ never-say-die +nevermind NN nevermind +neverminds NNS nevermind +nevermore RB nevermore +nevertheless CC nevertheless +nevertheless RB nevertheless +neves NNS neve +neves NNS nef +nevi NNS nevus +nevirapine NN nevirapine +nevoid JJ nevoid +nevus NN nevus +new JJ new +new-car JJ new-car +new-fashioned JJ new-fashioned +new-made JJ new-made +new-model JJ new-model +new-mown JJ new-mown +new-rich JJ new-rich +new-rich NN new-rich +new-sprung JJ new-sprung +newari NN newari +newbie NN newbie +newbies NNS newbie +newborn JJ newborn +newborn NN newborn +newborns NNS newborn +newcomer NN newcomer +newcomers NNS newcomer +newel NN newel +newels NNS newel +newer JJR new +newest JJS new +newfangled JJ newfangled +newfangledly RB newfangledly +newfangledness NN newfangledness +newfanglednesses NNS newfangledness +newfound JJ newfound +newground NN newground +newie NN newie +newies NNS newie +newish JJ newish +newline NN newline +newlines NNS newline +newly RB newly +newlywed NN newlywed +newlyweds NNS newlywed +newmarket NN newmarket +newmarkets NNS newmarket +newmusic JJ newmusic +newness NN newness +newnesses NNS newness +news NN news +newsagent NN newsagent +newsagents NNS newsagent +newsbeat NN newsbeat +newsbeats NNS newsbeat +newsboard NN newsboard +newsboy NN newsboy +newsboys NNS newsboy +newsbreak NN newsbreak +newsbreaks NNS newsbreak +newscast NN newscast +newscaster NN newscaster +newscasters NNS newscaster +newscasting NN newscasting +newscastings NNS newscasting +newscasts NNS newscast +newsdealer NN newsdealer +newsdealers NNS newsdealer +newsdesk NN newsdesk +newsdesks NNS newsdesk +newses NNS news +newsflash NN newsflash +newsflashes NNS newsflash +newsgathering NN newsgathering +newsgatherings NNS newsgathering +newsgirl NN newsgirl +newsgirls NNS newsgirl +newsgroup NN newsgroup +newsgroups NNS newsgroup +newshawk NN newshawk +newshawks NNS newshawk +newshen NN newshen +newshound NN newshound +newshounds NNS newshound +newsie JJ newsie +newsie NN newsie +newsier JJR newsie +newsier JJR newsy +newsies NNS newsie +newsiest JJS newsie +newsiest JJS newsy +newsiness NN newsiness +newsinesses NNS newsiness +newsless JJ newsless +newslessness NN newslessness +newsletter NN newsletter +newsletters NNS newsletter +newsmagazine NN newsmagazine +newsmagazines NNS newsmagazine +newsmaker NN newsmaker +newsmakers NNS newsmaker +newsman NN newsman +newsmen NNS newsman +newsmonger NN newsmonger +newsmongers NNS newsmonger +newspaper NNN newspaper +newspaperdom NN newspaperdom +newspapering NN newspapering +newspaperings NNS newspapering +newspaperish JJ newspaperish +newspaperman NN newspaperman +newspapermen NNS newspaperman +newspapers NNS newspaper +newspaperwoman NN newspaperwoman +newspaperwomen NNS newspaperwoman +newspeak NN newspeak +newspeaks NNS newspeak +newspeople NNS newsperson +newsperson NN newsperson +newspersons NNS newsperson +newsprint NN newsprint +newsprints NNS newsprint +newsreader NN newsreader +newsreaders NNS newsreader +newsreel NNN newsreel +newsreels NNS newsreel +newsroom NN newsroom +newsrooms NNS newsroom +newssheet NN newssheet +newssheets NNS newssheet +newsstand NN newsstand +newsstands NNS newsstand +newsvendor NN newsvendor +sissonne NN sissonne +sissoo NN sissoo +sissoos NNS sissoo +sissu NN sissu +sissy JJ sissy +sissy NN sissy +sissyish JJ sissyish +sissyness NN sissyness +sissynesses NNS sissyness +sister JJ sister +sister NN sister +sister-in-law NN sister-in-law +sisterhood NN sisterhood +sisterhoods NNS sisterhood +sisterless JJ sisterless +sisterlike JJ sisterlike +sisterliness NN sisterliness +sisterlinesses NNS sisterliness +sisterly RB sisterly +sisters NNS sister +sisters-in-law NNS sister-in-law +sistership NN sistership +sistroid JJ sistroid +sistrum NN sistrum +sistrums NNS sistrum +sistrurus NN sistrurus +sisyridae NN sisyridae +sisyrinchium NN sisyrinchium +sit VB sit +sit VBP sit +sit-down NNN sit-down +sit-up NN sit-up +sit-upon NN sit-upon +sitar NN sitar +sitarist NN sitarist +sitarists NNS sitarist +sitars NNS sitar +sitatunga NN sitatunga +sitatungas NNS sitatunga +sitcom NN sitcom +sitcoms NNS sitcom +sitdown NN sitdown +sitdowns NNS sitdown +site NN site +site VB site +site VBP site +site-specific JJ site-specific +sited VBD site +sited VBN site +sitella NN sitella +sitellas NNS sitella +sites NNS site +sites VBZ site +sitewide JJ sitewide +sitfast NN sitfast +sitfasts NNS sitfast +sith CC sith +sith RB sith +sithe NN sithe +sithen NN sithen +sithens NNS sithen +sithes NNS sithe +siting VBG site +sitologies NNS sitology +sitology NNN sitology +sitomania NN sitomania +sitomanias NNS sitomania +sitophylus NN sitophylus +sitosterol NN sitosterol +sitosterols NNS sitosterol +sitotroga NN sitotroga +sitrep NN sitrep +sitreps NNS sitrep +sits VBZ sit +sitta NN sitta +sitter NN sitter +sitters NNS sitter \ No newline at end of file diff --git a/core-java-modules/core-java-12/README.md b/core-java-modules/core-java-12/README.md index b509be876c..4ad7bae21c 100644 --- a/core-java-modules/core-java-12/README.md +++ b/core-java-modules/core-java-12/README.md @@ -2,3 +2,4 @@ - [String API Updates in Java 12](https://www.baeldung.com/java12-string-api) - [New Features in Java 12](https://www.baeldung.com/java-12-new-features) +- [Compare the Content of Two Files in Java](https://www.baeldung.com/java-compare-files) diff --git a/core-java-modules/core-java-16/pom.xml b/core-java-modules/core-java-16/pom.xml index 230e342f01..a8a84511db 100644 --- a/core-java-modules/core-java-16/pom.xml +++ b/core-java-modules/core-java-16/pom.xml @@ -1,48 +1,53 @@ - 4.0.0 - core-java-16 - 0.1.0-SNAPSHOT - core-java-16 - jar - http://maven.apache.org + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + core-java-16 + 0.1.0-SNAPSHOT + core-java-16 + jar + http://maven.apache.org - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - ../../ - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + - - - org.assertj - assertj-core - ${assertj.version} - test - - + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.apache.commons + commons-lang3 + 3.12.0 + + - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - ${maven.compiler.source.version} - ${maven.compiler.target.version} - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source.version} + ${maven.compiler.target.version} + + + + - - 16 - 16 - 3.6.1 - + + 16 + 16 + 3.6.1 + \ No newline at end of file diff --git a/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPost.java b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPost.java new file mode 100644 index 0000000000..960a75a58e --- /dev/null +++ b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPost.java @@ -0,0 +1,43 @@ +package com.baeldung.java_16_features.groupingby; + +import java.util.IntSummaryStatistics; + + +public class BlogPost { + + private String title; + private String author; + private BlogPostType type; + private int likes; + record AuthPostTypesLikes(String author, BlogPostType type, int likes) {}; + record PostcountTitlesLikesStats(long postCount, String titles, IntSummaryStatistics likesStats){}; + record TitlesBoundedSumOfLikes(String titles, int boundedSumOfLikes) {}; + + public BlogPost(String title, String author, BlogPostType type, int likes) { + this.title = title; + this.author = author; + this.type = type; + this.likes = likes; + } + + public String getTitle() { + return title; + } + + public String getAuthor() { + return author; + } + + public BlogPostType getType() { + return type; + } + + public int getLikes() { + return likes; + } + + @Override + public String toString() { + return "BlogPost{" + "title='" + title + '\'' + ", type=" + type + ", likes=" + likes + '}'; + } +} diff --git a/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPostType.java b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPostType.java new file mode 100644 index 0000000000..df38b7e1c4 --- /dev/null +++ b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/BlogPostType.java @@ -0,0 +1,5 @@ +package com.baeldung.java_16_features.groupingby; + +public enum BlogPostType { + NEWS, REVIEW, GUIDE +} diff --git a/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/Tuple.java b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/Tuple.java new file mode 100644 index 0000000000..ad41207aa4 --- /dev/null +++ b/core-java-modules/core-java-16/src/main/java/com/baeldung/java_16_features/groupingby/Tuple.java @@ -0,0 +1,41 @@ +package com.baeldung.java_16_features.groupingby; + +import java.util.Objects; + +public class Tuple { + private final BlogPostType type; + private final String author; + + public Tuple(BlogPostType type, String author) { + this.type = type; + this.author = author; + } + + public BlogPostType getType() { + return type; + } + + public String getAuthor() { + return author; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Tuple tuple = (Tuple) o; + return type == tuple.type && author.equals(tuple.author); + } + + @Override + public int hashCode() { + return Objects.hash(type, author); + } + + @Override + public String toString() { + return "Tuple{" + "type=" + type + ", author='" + author + '\'' + '}'; + } +} diff --git a/core-java-modules/core-java-16/src/test/java/com/baeldung/java_16_features/groupingby/JavaGroupingByCollectorUnitTest.java b/core-java-modules/core-java-16/src/test/java/com/baeldung/java_16_features/groupingby/JavaGroupingByCollectorUnitTest.java new file mode 100644 index 0000000000..0dea142658 --- /dev/null +++ b/core-java-modules/core-java-16/src/test/java/com/baeldung/java_16_features/groupingby/JavaGroupingByCollectorUnitTest.java @@ -0,0 +1,302 @@ +package com.baeldung.java_16_features.groupingby; + +import static java.util.Comparator.comparingInt; +import static java.util.stream.Collectors.averagingInt; +import static java.util.stream.Collectors.counting; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.groupingByConcurrent; +import static java.util.stream.Collectors.collectingAndThen; +import static java.util.stream.Collectors.toMap; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.maxBy; +import static java.util.stream.Collectors.summarizingInt; +import static java.util.stream.Collectors.summingInt; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toSet; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.offset; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Arrays; +import java.util.EnumMap; +import java.util.IntSummaryStatistics; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ConcurrentMap; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.junit.jupiter.api.Test; + +public class JavaGroupingByCollectorUnitTest { + + private static final List posts = Arrays.asList(new BlogPost("News item 1", "Author 1", BlogPostType.NEWS, 15), new BlogPost("Tech review 1", "Author 2", BlogPostType.REVIEW, 5), + new BlogPost("Programming guide", "Author 1", BlogPostType.GUIDE, 20), new BlogPost("News item 2", "Author 2", BlogPostType.NEWS, 35), new BlogPost("Tech review 2", "Author 1", BlogPostType.REVIEW, 15)); + + @Test + public void givenAListOfPosts_whenGroupedByType_thenGetAMapBetweenTypeAndPosts() { + Map> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType)); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndTheirTitlesAreJoinedInAString_thenGetAMapBetweenTypeAndCsvTitles() { + Map postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, mapping(BlogPost::getTitle, joining(", ", "Post titles: [", "]")))); + + assertEquals("Post titles: [News item 1, News item 2]", postsPerType.get(BlogPostType.NEWS)); + assertEquals("Post titles: [Programming guide]", postsPerType.get(BlogPostType.GUIDE)); + assertEquals("Post titles: [Tech review 1, Tech review 2]", postsPerType.get(BlogPostType.REVIEW)); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndSumTheLikes_thenGetAMapBetweenTypeAndPostLikes() { + Map likesPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, summingInt(BlogPost::getLikes))); + + assertEquals(50, likesPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(20, likesPerType.get(BlogPostType.REVIEW) + .intValue()); + assertEquals(20, likesPerType.get(BlogPostType.GUIDE) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeInAnEnumMap_thenGetAnEnumMapBetweenTypeAndPosts() { + EnumMap> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, () -> new EnumMap<>(BlogPostType.class), toList())); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeInSets_thenGetAMapBetweenTypesAndSetsOfPosts() { + Map> postsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, toSet())); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeConcurrently_thenGetAMapBetweenTypeAndPosts() { + ConcurrentMap> postsPerType = posts.parallelStream() + .collect(groupingByConcurrent(BlogPost::getType)); + + assertEquals(2, postsPerType.get(BlogPostType.NEWS) + .size()); + assertEquals(1, postsPerType.get(BlogPostType.GUIDE) + .size()); + assertEquals(2, postsPerType.get(BlogPostType.REVIEW) + .size()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndAveragingLikes_thenGetAMapBetweenTypeAndAverageNumberOfLikes() { + Map averageLikesPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, averagingInt(BlogPost::getLikes))); + + assertEquals(25, averageLikesPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(20, averageLikesPerType.get(BlogPostType.GUIDE) + .intValue()); + assertEquals(10, averageLikesPerType.get(BlogPostType.REVIEW) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndCounted_thenGetAMapBetweenTypeAndNumberOfPosts() { + Map numberOfPostsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, counting())); + + assertEquals(2, numberOfPostsPerType.get(BlogPostType.NEWS) + .intValue()); + assertEquals(1, numberOfPostsPerType.get(BlogPostType.GUIDE) + .intValue()); + assertEquals(2, numberOfPostsPerType.get(BlogPostType.REVIEW) + .intValue()); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndMaxingLikes_thenGetAMapBetweenTypeAndMaximumNumberOfLikes() { + Map> maxLikesPerPostType = posts.stream() + .collect(groupingBy(BlogPost::getType, maxBy(comparingInt(BlogPost::getLikes)))); + + assertTrue(maxLikesPerPostType.get(BlogPostType.NEWS) + .isPresent()); + assertEquals(35, maxLikesPerPostType.get(BlogPostType.NEWS) + .get() + .getLikes()); + + assertTrue(maxLikesPerPostType.get(BlogPostType.GUIDE) + .isPresent()); + assertEquals(20, maxLikesPerPostType.get(BlogPostType.GUIDE) + .get() + .getLikes()); + + assertTrue(maxLikesPerPostType.get(BlogPostType.REVIEW) + .isPresent()); + assertEquals(15, maxLikesPerPostType.get(BlogPostType.REVIEW) + .get() + .getLikes()); + } + + @Test + public void givenAListOfPosts_whenGroupedByAuthorAndThenByType_thenGetAMapBetweenAuthorAndMapsBetweenTypeAndBlogPosts() { + Map>> map = posts.stream() + .collect(groupingBy(BlogPost::getAuthor, groupingBy(BlogPost::getType))); + + assertEquals(1, map.get("Author 1") + .get(BlogPostType.NEWS) + .size()); + assertEquals(1, map.get("Author 1") + .get(BlogPostType.GUIDE) + .size()); + assertEquals(1, map.get("Author 1") + .get(BlogPostType.REVIEW) + .size()); + + assertEquals(1, map.get("Author 2") + .get(BlogPostType.NEWS) + .size()); + assertEquals(1, map.get("Author 2") + .get(BlogPostType.REVIEW) + .size()); + assertNull(map.get("Author 2") + .get(BlogPostType.GUIDE)); + } + + @Test + public void givenAListOfPosts_whenGroupedByTypeAndSummarizingLikes_thenGetAMapBetweenTypeAndSummary() { + Map likeStatisticsPerType = posts.stream() + .collect(groupingBy(BlogPost::getType, summarizingInt(BlogPost::getLikes))); + + IntSummaryStatistics newsLikeStatistics = likeStatisticsPerType.get(BlogPostType.NEWS); + + assertEquals(2, newsLikeStatistics.getCount()); + assertEquals(50, newsLikeStatistics.getSum()); + assertEquals(25.0, newsLikeStatistics.getAverage(), 0.001); + assertEquals(35, newsLikeStatistics.getMax()); + assertEquals(15, newsLikeStatistics.getMin()); + } + + @Test + public void givenAListOfPosts_whenGroupedByComplexMapPairKeyType_thenGetAMapBetweenPairAndList() { + + Map, List> postsPerTypeAndAuthor = posts.stream() + .collect(groupingBy(post -> new ImmutablePair<>(post.getType(), post.getAuthor()))); + + List result = postsPerTypeAndAuthor.get(new ImmutablePair<>(BlogPostType.GUIDE, "Author 1")); + + assertThat(result.size()).isEqualTo(1); + + BlogPost blogPost = result.get(0); + + assertThat(blogPost.getTitle()).isEqualTo("Programming guide"); + assertThat(blogPost.getType()).isEqualTo(BlogPostType.GUIDE); + assertThat(blogPost.getAuthor()).isEqualTo("Author 1"); + } + + @Test + public void givenAListOfPosts_whenGroupedByComplexMapKeyType_thenGetAMapBetweenTupleAndList() { + + Map> postsPerTypeAndAuthor = posts.stream() + .collect(groupingBy(post -> new Tuple(post.getType(), post.getAuthor()))); + + List result = postsPerTypeAndAuthor.get(new Tuple(BlogPostType.GUIDE, "Author 1")); + + assertThat(result.size()).isEqualTo(1); + + BlogPost blogPost = result.get(0); + + assertThat(blogPost.getTitle()).isEqualTo("Programming guide"); + assertThat(blogPost.getType()).isEqualTo(BlogPostType.GUIDE); + assertThat(blogPost.getAuthor()).isEqualTo("Author 1"); + } + + @Test + public void givenAListOfPosts_whenGroupedByRecord_thenGetAMapBetweenRecordAndList() { + + Map> postsPerTypeAndAuthor = posts.stream() + .collect(groupingBy(post -> new BlogPost.AuthPostTypesLikes(post.getAuthor(), post.getType(), post.getLikes()))); + + List result = postsPerTypeAndAuthor.get(new BlogPost.AuthPostTypesLikes("Author 1", BlogPostType.GUIDE, 20)); + + assertThat(result.size()).isEqualTo(1); + + BlogPost blogPost = result.get(0); + + assertThat(blogPost.getTitle()).isEqualTo("Programming guide"); + assertThat(blogPost.getType()).isEqualTo(BlogPostType.GUIDE); + assertThat(blogPost.getAuthor()).isEqualTo("Author 1"); + assertThat(blogPost.getLikes()).isEqualTo(20); + } + + @Test + public void givenListOfPosts_whenGroupedByAuthor_thenGetAMapUsingCollectingAndThen() { + + Map postsPerAuthor = posts.stream() + .collect(groupingBy(BlogPost::getAuthor, collectingAndThen(toList(), list -> { + long count = list.stream() + .map(BlogPost::getTitle) + .collect(counting()); + String titles = list.stream() + .map(BlogPost::getTitle) + .collect(joining(" : ")); + IntSummaryStatistics summary = list.stream() + .collect(summarizingInt(BlogPost::getLikes)); + return new BlogPost.PostcountTitlesLikesStats(count, titles, summary); + }))); + + BlogPost.PostcountTitlesLikesStats result = postsPerAuthor.get("Author 1"); + assertThat(result.postCount()).isEqualTo(3L); + assertThat(result.titles()).isEqualTo("News item 1 : Programming guide : Tech review 2"); + assertThat(result.likesStats().getMax()).isEqualTo(20); + assertThat(result.likesStats().getMin()).isEqualTo(15); + assertThat(result.likesStats().getAverage()).isEqualTo(16.666d, offset(0.001d)); + } + + @Test + public void givenListOfPosts_whenGroupedByAuthor_thenGetAMapUsingToMap() { + + int maxValLikes = 17; + Map postsPerAuthor = posts.stream() + .collect(toMap(BlogPost::getAuthor, post -> { + int likes = (post.getLikes() > maxValLikes) ? maxValLikes : post.getLikes(); + return new BlogPost.TitlesBoundedSumOfLikes(post.getTitle(), likes); + }, (u1, u2) -> { + int likes = (u2.boundedSumOfLikes() > maxValLikes) ? maxValLikes : u2.boundedSumOfLikes(); + return new BlogPost.TitlesBoundedSumOfLikes(u1.titles() + .toUpperCase() + " : " + + u2.titles() + .toUpperCase(), + u1.boundedSumOfLikes() + likes); + })); + + BlogPost.TitlesBoundedSumOfLikes result = postsPerAuthor.get("Author 1"); + assertThat(result.titles()).isEqualTo("NEWS ITEM 1 : PROGRAMMING GUIDE : TECH REVIEW 2"); + assertThat(result.boundedSumOfLikes()).isEqualTo(47); + } +} diff --git a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java index 20f66da5da..a3c7dc02db 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/main/java/com/baeldung/concurrent/stopexecution/StopExecution.java @@ -189,21 +189,8 @@ public class StopExecution { longRunningSort(); } - private void longRunningOperation() { - LOG.info("long Running operation started"); - - try { - //Thread.sleep(500); - longFileRead(); - LOG.info("long running operation finished"); - } catch (InterruptedException e) { - LOG.info("long Running operation interrupted"); - } - } - private void longRunningSort() { - LOG.info("long Running task started"); - // Do you long running calculation here + LOG.info("Long running task started"); int len = 100000; List numbers = new ArrayList<>(); try { @@ -229,25 +216,7 @@ public class StopExecution { LOG.info("Index position: " + i); LOG.info("Long running task finished"); } catch (InterruptedException e) { - LOG.info("long Running operation interrupted"); - } - } - - private void longFileRead() throws InterruptedException { - String file = "input.txt"; - ClassLoader classloader = getClass().getClassLoader(); - - try (InputStream inputStream = classloader.getResourceAsStream(file)) { - Reader inputStreamReader = new InputStreamReader(inputStream); - - int data = inputStreamReader.read(); - while (data != -1) { - char theChar = (char) data; - data = inputStreamReader.read(); - throwExceptionOnThreadInterrupt(); - } - } catch (IOException e) { - LOG.error("Exception: ", e); + LOG.info("Long running operation interrupted"); } } diff --git a/core-java-modules/core-java-date-operations-1/src/main/java/com/baeldung/java9/time/TimeApi.java b/core-java-modules/core-java-date-operations-1/src/main/java/com/baeldung/java9/time/TimeApi.java index ee4e35a77b..dee3135391 100644 --- a/core-java-modules/core-java-date-operations-1/src/main/java/com/baeldung/java9/time/TimeApi.java +++ b/core-java-modules/core-java-date-operations-1/src/main/java/com/baeldung/java9/time/TimeApi.java @@ -13,12 +13,9 @@ import java.util.stream.IntStream; public class TimeApi { public static List getDatesBetweenUsingJava7(Date startDate, Date endDate) { - List datesInRange = new ArrayList(); - Calendar calendar = new GregorianCalendar(); - calendar.setTime(startDate); - - Calendar endCalendar = new GregorianCalendar(); - endCalendar.setTime(endDate); + List datesInRange = new ArrayList<>(); + Calendar calendar = getCalendarWithoutTime(startDate); + Calendar endCalendar = getCalendarWithoutTime(endDate); while (calendar.before(endCalendar)) { Date result = calendar.getTime(); @@ -40,4 +37,15 @@ public class TimeApi { return startDate.datesUntil(endDate).collect(Collectors.toList()); } + private static Calendar getCalendarWithoutTime(Date date) { + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + calendar.set(Calendar.HOUR, 0); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar; + } + } diff --git a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java index 8813870c2b..416a621286 100644 --- a/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java +++ b/core-java-modules/core-java-date-operations-1/src/test/java/com/baeldung/java9/time/TimeApiUnitTest.java @@ -1,12 +1,13 @@ package com.baeldung.java9.time; +import org.junit.Test; + import java.time.LocalDate; import java.util.Calendar; import java.util.Date; import java.util.List; -import static org.junit.Assert.assertEquals; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; public class TimeApiUnitTest { @@ -18,19 +19,18 @@ public class TimeApiUnitTest { Date endDate = endCalendar.getTime(); List dates = TimeApi.getDatesBetweenUsingJava7(startDate, endDate); - assertEquals(dates.size(), 2); + + assertThat(dates).hasSize(2); Calendar calendar = Calendar.getInstance(); - Date date1 = calendar.getTime(); - assertEquals(dates.get(0).getDay(), date1.getDay()); - assertEquals(dates.get(0).getMonth(), date1.getMonth()); - assertEquals(dates.get(0).getYear(), date1.getYear()); + Date expectedDate1 = calendar.getTime(); + assertThat(dates.get(0)).isInSameDayAs(expectedDate1); + assertThatTimeFieldsAreZero(dates.get(0)); calendar.add(Calendar.DATE, 1); - Date date2 = calendar.getTime(); - assertEquals(dates.get(1).getDay(), date2.getDay()); - assertEquals(dates.get(1).getMonth(), date2.getMonth()); - assertEquals(dates.get(1).getYear(), date2.getYear()); + Date expectedDate2 = calendar.getTime(); + assertThat(dates.get(1)).isInSameDayAs(expectedDate2); + assertThatTimeFieldsAreZero(dates.get(1)); } @Test @@ -39,9 +39,8 @@ public class TimeApiUnitTest { LocalDate endDate = LocalDate.now().plusDays(2); List dates = TimeApi.getDatesBetweenUsingJava8(startDate, endDate); - assertEquals(dates.size(), 2); - assertEquals(dates.get(0), LocalDate.now()); - assertEquals(dates.get(1), LocalDate.now().plusDays(1)); + + assertThat(dates).containsExactly(LocalDate.now(), LocalDate.now().plusDays(1)); } @Test @@ -50,9 +49,15 @@ public class TimeApiUnitTest { LocalDate endDate = LocalDate.now().plusDays(2); List dates = TimeApi.getDatesBetweenUsingJava9(startDate, endDate); - assertEquals(dates.size(), 2); - assertEquals(dates.get(0), LocalDate.now()); - assertEquals(dates.get(1), LocalDate.now().plusDays(1)); + + assertThat(dates).containsExactly(LocalDate.now(), LocalDate.now().plusDays(1)); + } + + private static void assertThatTimeFieldsAreZero(Date date) { + assertThat(date).hasHourOfDay(0); + assertThat(date).hasMinute(0); + assertThat(date).hasSecond(0); + assertThat(date).hasMillisecond(0); } } diff --git a/core-java-modules/core-java-datetime-string/pom.xml b/core-java-modules/core-java-datetime-string/pom.xml index dc0c5fd8b1..f50eb2ae5e 100644 --- a/core-java-modules/core-java-datetime-string/pom.xml +++ b/core-java-modules/core-java-datetime-string/pom.xml @@ -75,7 +75,7 @@ 1.6 - 2.10 + 2.10.10 3.6.1 1.9 diff --git a/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/formatduration/FormatDurationUnitTest.java b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/formatduration/FormatDurationUnitTest.java new file mode 100644 index 0000000000..1612edd30b --- /dev/null +++ b/core-java-modules/core-java-datetime-string/src/test/java/com/baeldung/formatduration/FormatDurationUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.formatduration; + +import org.apache.commons.lang3.time.DurationFormatUtils; +import org.joda.time.Period; +import org.junit.Test; + +import java.time.Duration; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; + +public class FormatDurationUnitTest { + + + @Test + public void givenInterval_WhenFormatInterval_formatDuration() { + long HH = TimeUnit.MILLISECONDS.toHours(38114000); + long MM = TimeUnit.MILLISECONDS.toMinutes(38114000) % 60; + long SS = TimeUnit.MILLISECONDS.toSeconds(38114000) % 60; + String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS); + + assertThat(timeInHHMMSS).isEqualTo("10:35:14"); + } + + @Test + public void givenInterval_WhenFormatUsingDuration_formatDuration() { + Duration duration = Duration.ofMillis(38114000); + long seconds = duration.getSeconds(); + long HH = seconds / 3600; + long MM = (seconds % 3600) / 60; + long SS = seconds % 60; + String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS); + assertThat(timeInHHMMSS).isEqualTo("10:35:14"); + } + + + @Test + public void givenInterval_WhenFormatDurationUsingApacheCommons_formatDuration() { + assertThat(DurationFormatUtils.formatDuration(38114000, "HH:mm:ss")) + .isEqualTo("10:35:14"); + } + + @Test + public void givenInterval_WhenFormatDurationUsingJodaTime_formatDuration() { + org.joda.time.Duration duration = new org.joda.time.Duration(38114000); + Period period = duration.toPeriod(); + long HH = period.getHours(); + long MM = period.getMinutes(); + long SS = period.getSeconds(); + + String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS); + assertThat(timeInHHMMSS).isEqualTo("10:35:14"); + } +} diff --git a/core-java-modules/core-java-lang-oop-constructors/README.md b/core-java-modules/core-java-lang-oop-constructors/README.md index 4bec8db256..69ade3e25a 100644 --- a/core-java-modules/core-java-lang-oop-constructors/README.md +++ b/core-java-modules/core-java-lang-oop-constructors/README.md @@ -7,3 +7,4 @@ This module contains article about constructors in Java - [Java Copy Constructor](https://www.baeldung.com/java-copy-constructor) - [Cannot Reference “X” Before Supertype Constructor Has Been Called](https://www.baeldung.com/java-cannot-reference-x-before-supertype-constructor-error) - [Private Constructors in Java](https://www.baeldung.com/java-private-constructors) +- [Throwing Exceptions in Constructors](https://www.baeldung.com/java-constructors-exceptions) diff --git a/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Animal.java b/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Animal.java new file mode 100644 index 0000000000..1927bc4455 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Animal.java @@ -0,0 +1,32 @@ +package com.baeldung.constructors.exception; + +import java.io.File; +import java.io.IOException; + +public class Animal { + + public Animal() throws InstantiationException { + throw new InstantiationException("Cannot be instantiated"); + } + + public Animal(String id, int age) { + if (id == null) + throw new NullPointerException("Id cannot be null"); + if (age < 0) + throw new IllegalArgumentException("Age cannot be negative"); + } + + public Animal(File file) throws SecurityException, IOException { + // Avoiding Path traversal attacks + if (file.isAbsolute()) { + throw new SecurityException("Traversal attack - absolute path not allowed"); + } + // Avoiding directory traversal + // a/../..b/ + if (!file.getCanonicalPath() + .equals(file.getAbsolutePath())) { + throw new SecurityException("Directory traversal attempt?"); + } + } + +} diff --git a/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Bird.java b/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Bird.java new file mode 100644 index 0000000000..6e6e6558ba --- /dev/null +++ b/core-java-modules/core-java-lang-oop-constructors/src/main/java/com/baeldung/constructors/exception/Bird.java @@ -0,0 +1,13 @@ +package com.baeldung.constructors.exception; + +public class Bird extends Animal { + + // Note that we are throwing parent exception + public Bird() throws ReflectiveOperationException { + super(); + } + + public Bird(String id, int age) { + super(id, age); + } +} diff --git a/core-java-modules/core-java-lang-oop-constructors/src/test/java/com/baeldung/constructors/exception/AnimalUnitTest.java b/core-java-modules/core-java-lang-oop-constructors/src/test/java/com/baeldung/constructors/exception/AnimalUnitTest.java new file mode 100644 index 0000000000..8f7ed440f6 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-constructors/src/test/java/com/baeldung/constructors/exception/AnimalUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.constructors.exception; + +import java.io.File; + +import org.assertj.core.api.Assertions; +import org.junit.Test; + +public class AnimalUnitTest { + + @Test + public void givenNoArgument_thenFails() { + Assertions.assertThatThrownBy(() -> { + new Animal(); + }) + .isInstanceOf(Exception.class); + } + + @Test + public void givenInvalidArg_thenFails() { + Assertions.assertThatThrownBy(() -> { + new Animal(null, 30); + }) + .isInstanceOf(NullPointerException.class); + } + + @Test(expected = Test.None.class) + public void givenValidArg_thenSuccess() { + new Animal("1234", 30); + } + + @Test + public void givenAbsolutePath_thenFails() { + Assertions.assertThatThrownBy(() -> { + new Animal(new File("temp.txt").getAbsoluteFile()); + }) + .isInstanceOf(SecurityException.class); + } + + @Test + public void givenDirectoryTraversalPath_thenFails() { + Assertions.assertThatThrownBy(() -> { + new Animal(new File(File.separator + ".." + File.separator + "temp.txt")); + }) + .isInstanceOf(SecurityException.class); + } + +} diff --git a/core-java-modules/core-java-lang-operators-2/README.md b/core-java-modules/core-java-lang-operators-2/README.md index 1a4c01c6e5..bc1809a4a7 100644 --- a/core-java-modules/core-java-lang-operators-2/README.md +++ b/core-java-modules/core-java-lang-operators-2/README.md @@ -5,3 +5,4 @@ This module contains articles about Java operators ## Relevant Articles: - [Logical vs Bitwise OR Operator](https://www.baeldung.com/java-logical-vs-bitwise-or-operator) +- [Bitmasking in Java with Bitwise Operators](https://www.baeldung.com/java-bitmasking) diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java index 3ea7acf620..5c9da0cc9e 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java @@ -25,9 +25,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenGrepWithSimpleString_thenCorrect() { - int expectedLineCount = 4; + int expectedLineCount = 5; - // grep "NINETEEN" dictionary.txt + // grep "NINETEEN" dictionary.in List lines = Unix4j.grep("NINETEEN", fileToGrep).toLineList(); assertEquals(expectedLineCount, lines.size()); @@ -35,9 +35,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenInverseGrepWithSimpleString_thenCorrect() { - int expectedLineCount = 178687; + int expectedLineCount = 8; - // grep -v "NINETEEN" dictionary.txt + // grep -v "NINETEEN" dictionary.in List lines = grep(Options.v, "NINETEEN", fileToGrep).toLineList(); assertEquals(expectedLineCount, lines.size()); @@ -45,9 +45,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenGrepWithRegex_thenCorrect() { - int expectedLineCount = 151; + int expectedLineCount = 5; - // grep -c ".*?NINE.*?" dictionary.txt + // grep -c ".*?NINE.*?" dictionary.in String patternCount = grep(Options.c, ".*?NINE.*?", fileToGrep).cut(fields, ":", 1).toStringResult(); assertEquals(expectedLineCount, Integer.parseInt(patternCount)); diff --git a/core-java-modules/core-java-os/src/test/resources/dictionary.in b/core-java-modules/core-java-os/src/test/resources/dictionary.in new file mode 100644 index 0000000000..9e6c74ecdb --- /dev/null +++ b/core-java-modules/core-java-os/src/test/resources/dictionary.in @@ -0,0 +1,13 @@ +EIGHTTEEN +EIGHTTEENS +EIGHTTEENTH +EIGHTTEENTHS +NINETEEN +NINETEENS +NINETEENTH +NINETEENTHS +TWENTY +TWENTHIES +TWENTHIETH +TWENTHIETHS +TWENTYNINETEEN \ No newline at end of file diff --git a/core-java-modules/core-java-string-operations-3/README.md b/core-java-modules/core-java-string-operations-3/README.md index ad4ada3a68..ff6ac51fab 100644 --- a/core-java-modules/core-java-string-operations-3/README.md +++ b/core-java-modules/core-java-string-operations-3/README.md @@ -4,3 +4,4 @@ - [Java (String) or .toString()?](https://www.baeldung.com/java-string-casting-vs-tostring) - [Split Java String by Newline](https://www.baeldung.com/java-string-split-by-newline) - [Split a String in Java and Keep the Delimiters](https://www.baeldung.com/java-split-string-keep-delimiters) +- [Validate String as Filename in Java](https://www.baeldung.com/java-validate-filename) diff --git a/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUtils.java b/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUtils.java new file mode 100644 index 0000000000..1a86edd45a --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/src/main/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUtils.java @@ -0,0 +1,61 @@ +package com.baeldung.stringfilenamevalidaiton; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Arrays; + +public class StringFilenameValidationUtils { + + public static final Character[] INVALID_WINDOWS_SPECIFIC_CHARS = {'"', '*', ':', '<', '>', '?', '\\', '|', 0x7F}; + public static final Character[] INVALID_UNIX_SPECIFIC_CHARS = {'\000'}; + + public static final String REGEX_PATTERN = "^[A-za-z0-9.]{1,255}$"; + + private StringFilenameValidationUtils() { + } + + public static boolean validateStringFilenameUsingIO(String filename) throws IOException { + File file = new File(filename); + boolean created = false; + try { + created = file.createNewFile(); + return created; + } finally { + if (created) { + file.delete(); + } + } + } + + public static boolean validateStringFilenameUsingNIO2(String filename) { + Paths.get(filename); + return true; + } + + public static boolean validateStringFilenameUsingContains(String filename) { + if (filename == null || filename.isEmpty() || filename.length() > 255) { + return false; + } + return Arrays.stream(getInvalidCharsByOS()) + .noneMatch(ch -> filename.contains(ch.toString())); + } + + public static boolean validateStringFilenameUsingRegex(String filename) { + if (filename == null) { + return false; + } + return filename.matches(REGEX_PATTERN); + } + + private static Character[] getInvalidCharsByOS() { + String os = System.getProperty("os.name").toLowerCase(); + if (os.contains("win")) { + return INVALID_WINDOWS_SPECIFIC_CHARS; + } else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) { + return INVALID_UNIX_SPECIFIC_CHARS; + } else { + return new Character[]{}; + } + } +} diff --git a/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUnitTest.java b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUnitTest.java new file mode 100644 index 0000000000..3e787f08be --- /dev/null +++ b/core-java-modules/core-java-string-operations-3/src/test/java/com/baeldung/stringfilenamevalidaiton/StringFilenameValidationUnitTest.java @@ -0,0 +1,130 @@ +package com.baeldung.stringfilenamevalidaiton; + +import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.RandomUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EmptySource; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.NullSource; + +import java.io.IOException; +import java.nio.file.InvalidPathException; +import java.util.Arrays; +import java.util.stream.Stream; + +import static com.baeldung.stringfilenamevalidaiton.StringFilenameValidationUtils.validateStringFilenameUsingContains; +import static com.baeldung.stringfilenamevalidaiton.StringFilenameValidationUtils.validateStringFilenameUsingIO; +import static com.baeldung.stringfilenamevalidaiton.StringFilenameValidationUtils.validateStringFilenameUsingNIO2; +import static com.baeldung.stringfilenamevalidaiton.StringFilenameValidationUtils.validateStringFilenameUsingRegex; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +public class StringFilenameValidationUnitTest { + + private static final String CORRECT_FILENAME_PATTERN = "baeldung.txt"; + + @ParameterizedTest + @MethodSource("correctAlphanumericFilenamesProvider") + public void givenCorrectAlphanumericRandomFilenameString_whenValidateUsingIO_thenReturnTrue(String filename) throws IOException { + assertThat(validateStringFilenameUsingIO(filename)).isTrue(); + assertThat(validateStringFilenameUsingNIO2(filename)).isTrue(); + assertThat(validateStringFilenameUsingContains(filename)).isTrue(); + assertThat(validateStringFilenameUsingRegex(filename)).isTrue(); + } + + @Test + public void givenTooLongFileNameString_whenValidate_thenIOAndCustomFailsNIO2Succeed() { + String filename = RandomStringUtils.randomAlphabetic(500); + assertThatThrownBy(() -> validateStringFilenameUsingIO(filename)) + .isInstanceOf(IOException.class) + .hasMessageContaining("File name too long"); + assertThat(validateStringFilenameUsingNIO2(filename)).isTrue(); + assertThat(validateStringFilenameUsingContains(filename)).isFalse(); + assertThat(validateStringFilenameUsingRegex(filename)).isFalse(); + } + + @ParameterizedTest + @NullSource + public void givenNullString_whenValidate_thenFails(String filename) { + assertThatThrownBy(() -> validateStringFilenameUsingIO(filename)) + .isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> validateStringFilenameUsingNIO2(filename)) + .isInstanceOf(NullPointerException.class); + assertThat(validateStringFilenameUsingContains(filename)).isFalse(); + assertThat(validateStringFilenameUsingRegex(filename)).isFalse(); + } + + @ParameterizedTest + @EmptySource + public void givenEmptyString_whenValidate_thenIOAndCustomFailsNIO2Succeed(String filename) { + assertThatThrownBy(() -> validateStringFilenameUsingIO(filename)) + .isInstanceOf(IOException.class); + assertThat(validateStringFilenameUsingNIO2(filename)).isTrue(); + assertThat(validateStringFilenameUsingContains(filename)).isFalse(); + assertThat(validateStringFilenameUsingRegex(filename)).isFalse(); + } + + @ParameterizedTest + @EnabledOnOs({OS.LINUX, OS.MAC}) + @MethodSource("filenamesWithInvalidWindowsChars") + public void givenFilenameStringWithInvalidWindowsCharAndIsUnix_whenValidateUsingIO_thenReturnTrue(String filename) throws IOException { + assertThat(validateStringFilenameUsingIO(filename)).isTrue(); + assertThat(validateStringFilenameUsingNIO2(filename)).isTrue(); + assertThat(validateStringFilenameUsingContains(filename)).isTrue(); + } + + @ParameterizedTest + @EnabledOnOs(OS.WINDOWS) + @MethodSource("filenamesWithInvalidWindowsChars") + public void givenFilenameStringWithInvalidWindowsCharAndIsWindows_whenValidateUsingIO_thenRaiseException(String filename) { + assertThatThrownBy(() -> validateStringFilenameUsingIO(filename)) + .isInstanceOf(IOException.class) + .hasMessageContaining("Invalid file path"); + + assertThatThrownBy(() -> validateStringFilenameUsingNIO2(filename)) + .isInstanceOf(InvalidPathException.class) + .hasMessage("character not allowed"); + + assertThat(validateStringFilenameUsingContains(filename)).isFalse(); + } + + @ParameterizedTest + @EnabledOnOs({OS.LINUX, OS.MAC}) + @MethodSource("filenamesWithInvalidUnixChars") + public void givenFilenameStringWithInvalidUnixCharAndIsUnix_whenValidate_thenRaiseException(String filename) { + assertThatThrownBy(() -> validateStringFilenameUsingIO(filename)) + .isInstanceOf(IOException.class) + .hasMessageContaining("Invalid file path"); + + assertThatThrownBy(() -> validateStringFilenameUsingNIO2(filename)) + .isInstanceOf(InvalidPathException.class) + .hasMessageContaining("character not allowed"); + + assertThat(validateStringFilenameUsingContains(filename)).isFalse(); + } + + + private static Stream correctAlphanumericFilenamesProvider() { + return Stream.generate(() -> RandomStringUtils.randomAlphanumeric(1, 10) + "." + RandomStringUtils.randomAlphabetic(3, 5)).limit(10); + } + + private static Stream filenamesWithInvalidWindowsChars() { + return Arrays.stream(StringFilenameValidationUtils.INVALID_WINDOWS_SPECIFIC_CHARS) + .map(character -> { + int idx = RandomUtils.nextInt(0, CORRECT_FILENAME_PATTERN.length()); + return CORRECT_FILENAME_PATTERN.substring(0, idx) + character + CORRECT_FILENAME_PATTERN.substring(idx); + }); + } + + private static Stream filenamesWithInvalidUnixChars() { + return Arrays.stream(StringFilenameValidationUtils.INVALID_UNIX_SPECIFIC_CHARS) + .map(character -> { + int idx = RandomUtils.nextInt(0, CORRECT_FILENAME_PATTERN.length()); + return CORRECT_FILENAME_PATTERN.substring(0, idx) + character + CORRECT_FILENAME_PATTERN.substring(idx); + }); + } + +} diff --git a/docker/heap-sizing/pom.xml b/docker/heap-sizing/pom.xml index a86a67fdcd..2cc354f6cf 100644 --- a/docker/heap-sizing/pom.xml +++ b/docker/heap-sizing/pom.xml @@ -1,21 +1,21 @@ - + 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.4.2 - - com.baeldung.docker heap-sizing 0.0.1-SNAPSHOT heap-sizing Demo project for Spring Boot - - 11 - + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + org.springframework.boot @@ -58,4 +58,8 @@ + + 11 + + diff --git a/drools/src/main/resources/logback.xml b/drools/src/main/resources/logback.xml index 7d900d8ea8..b928039804 100644 --- a/drools/src/main/resources/logback.xml +++ b/drools/src/main/resources/logback.xml @@ -6,7 +6,8 @@ - + + diff --git a/gradle/gradle-dependency-management/build.gradle b/gradle/gradle-dependency-management/build.gradle index 88ed84f4b1..787b23c382 100644 --- a/gradle/gradle-dependency-management/build.gradle +++ b/gradle/gradle-dependency-management/build.gradle @@ -3,6 +3,11 @@ plugins { id 'org.springframework.boot' version '2.3.4.RELEASE' } +ext { + springBootVersion = '2.3.4.RELEASE' + lombokVersion = '1.18.14' +} + group = 'com.gradle' version = '1.0.0' sourceCompatibility = '14' @@ -12,19 +17,16 @@ repositories { } dependencies { - implementation 'org.springframework.boot:spring-boot-starter:2.3.4.RELEASE' + implementation "org.springframework.boot:spring-boot-starter:${springBootVersion}" - testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.4.RELEASE' - - compileOnly 'org.projectlombok:lombok:1.18.14' - - testCompileOnly 'org.projectlombok:lombok:1.18.14' + compileOnly "org.projectlombok:lombok:${lombokVersion}" runtimeOnly files('libs/sampleOne.jar', 'libs/sampleTwo.jar') - - runtimeOnly fileTree('libs') { include '*.jar' } + runtimeOnly fileTree("libs") { include "*.jar" } -// implementation gradleApi() + testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}" + + testCompileOnly "org.projectlombok:lombok:${lombokVersion}" } test { diff --git a/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.jar b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..7454180f2a Binary files /dev/null and b/gradle/gradle-dependency-management/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/gradle-dependency-management/gradlew b/gradle/gradle-dependency-management/gradlew new file mode 100755 index 0000000000..1b6c787337 --- /dev/null +++ b/gradle/gradle-dependency-management/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# 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 +# +# https://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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradle/gradle-dependency-management/gradlew.bat b/gradle/gradle-dependency-management/gradlew.bat new file mode 100644 index 0000000000..ac1b06f938 --- /dev/null +++ b/gradle/gradle-dependency-management/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/gradle/gradle-dependency-management/libs/sampleOne.jar b/gradle/gradle-dependency-management/libs/sampleOne.jar new file mode 100644 index 0000000000..b8f564975e Binary files /dev/null and b/gradle/gradle-dependency-management/libs/sampleOne.jar differ diff --git a/gradle/gradle-dependency-management/libs/sampleTwo.jar b/gradle/gradle-dependency-management/libs/sampleTwo.jar new file mode 100644 index 0000000000..b8f564975e Binary files /dev/null and b/gradle/gradle-dependency-management/libs/sampleTwo.jar differ diff --git a/javafx/README.md b/javafx/README.md index 80c4f49026..8ef06eb012 100644 --- a/javafx/README.md +++ b/javafx/README.md @@ -3,5 +3,6 @@ This module contains articles about JavaFX. ### Relevant Articles: --[Introduction to JavaFX](https://www.baeldung.com/javafx) +- [Introduction to JavaFX](https://www.baeldung.com/javafx) +- [Display Custom Items in JavaFX ListView](https://www.baeldung.com/javafx-listview-display-custom-items) diff --git a/javafx/src/main/java/com/baeldung/listview/ExampleController.java b/javafx/src/main/java/com/baeldung/listview/ExampleController.java new file mode 100644 index 0000000000..c02fa68d2e --- /dev/null +++ b/javafx/src/main/java/com/baeldung/listview/ExampleController.java @@ -0,0 +1,38 @@ +package com.baeldung.listview; + +import com.baeldung.listview.cellfactory.CheckboxCellFactory; +import com.baeldung.listview.cellfactory.PersonCellFactory; +import javafx.collections.FXCollections; +import javafx.collections.ObservableList; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.ListView; + +import java.net.URL; +import java.util.ResourceBundle; + +public class ExampleController implements Initializable { + @FXML + private ListView listView; + + @Override + public void initialize(URL location, ResourceBundle resources) { + ObservableList wordsList = FXCollections.observableArrayList(); + wordsList.add(new Person("Isaac", "Newton")); + wordsList.add(new Person("Albert", "Einstein")); + wordsList.add(new Person("Ludwig", "Boltzmann")); + listView.setItems(wordsList); + } + + public void defaultButtonClick() { + listView.setCellFactory(null); + } + + public void cellFactoryButtonClick() { + listView.setCellFactory(new PersonCellFactory()); + } + + public void checkboxCellFactoryButtonClick() { + listView.setCellFactory(new CheckboxCellFactory()); + } +} diff --git a/javafx/src/main/java/com/baeldung/listview/Main.java b/javafx/src/main/java/com/baeldung/listview/Main.java new file mode 100644 index 0000000000..a067971758 --- /dev/null +++ b/javafx/src/main/java/com/baeldung/listview/Main.java @@ -0,0 +1,28 @@ +package com.baeldung.javafx.listview; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +import java.net.URL; + +public class Main extends Application { + + public static void main(String args[]) { + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + FXMLLoader loader = new FXMLLoader(); + URL xmlUrl = getClass().getResource("/example.fxml"); + loader.setLocation(xmlUrl); + Parent root = loader.load(); + + primaryStage.setTitle("List View Demo"); + primaryStage.setScene(new Scene(root)); + primaryStage.show(); + } +} diff --git a/javafx/src/main/java/com/baeldung/listview/Person.java b/javafx/src/main/java/com/baeldung/listview/Person.java new file mode 100644 index 0000000000..cdc0ab2dc8 --- /dev/null +++ b/javafx/src/main/java/com/baeldung/listview/Person.java @@ -0,0 +1,25 @@ +package com.baeldung.listview; + +public class Person { + + private final String firstName; + private final String lastName; + + public Person(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getFirstName() { + return firstName; + } + + public String getLastName() { + return lastName; + } + + @Override + public String toString() { + return firstName + " " + lastName; + } +} diff --git a/javafx/src/main/java/com/baeldung/listview/cellfactory/CheckboxCellFactory.java b/javafx/src/main/java/com/baeldung/listview/cellfactory/CheckboxCellFactory.java new file mode 100644 index 0000000000..522afcb76e --- /dev/null +++ b/javafx/src/main/java/com/baeldung/listview/cellfactory/CheckboxCellFactory.java @@ -0,0 +1,29 @@ +package com.baeldung.listview.cellfactory; + +import com.baeldung.listview.Person; +import javafx.scene.control.CheckBox; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.util.Callback; + +public class CheckboxCellFactory implements Callback, ListCell> { + @Override + public ListCell call(ListView param) { + return new ListCell(){ + @Override + public void updateItem(Person person, boolean empty) { + super.updateItem(person, empty); + if (empty) { + setText(null); + setGraphic(null); + } else if (person != null) { + setText(null); + setGraphic(new CheckBox(person.getFirstName() + " " + person.getLastName())); + } else { + setText("null"); + setGraphic(null); + } + } + }; + } +} diff --git a/javafx/src/main/java/com/baeldung/listview/cellfactory/PersonCellFactory.java b/javafx/src/main/java/com/baeldung/listview/cellfactory/PersonCellFactory.java new file mode 100644 index 0000000000..57866b9ead --- /dev/null +++ b/javafx/src/main/java/com/baeldung/listview/cellfactory/PersonCellFactory.java @@ -0,0 +1,23 @@ +package com.baeldung.listview.cellfactory; + +import com.baeldung.listview.Person; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.util.Callback; + +public class PersonCellFactory implements Callback, ListCell> { + @Override + public ListCell call(ListView param) { + return new ListCell(){ + @Override + public void updateItem(Person person, boolean empty) { + super.updateItem(person, empty); + if (empty || person == null) { + setText(null); + } else { + setText(person.getFirstName() + " " + person.getLastName()); + } + } + }; + } +} diff --git a/javafx/src/main/resources/example.fxml b/javafx/src/main/resources/example.fxml new file mode 100644 index 0000000000..c68df076d0 --- /dev/null +++ b/javafx/src/main/resources/example.fxml @@ -0,0 +1,14 @@ + + + + + + + + + +