Core JAVA
Java Development KIT (JDK)
Java Runtime Environment (JRE)
Java Virtual Machine (JVM)
Java overview
Java basics
Java Objects and classes
Java Constructors
Java basic datatypes
Java variable types
Java modifiers/Access Modifiers In Java
Java Basic Operators
Java Loops and Controls
Java conditions
Java numbers and characters
Java strings
Java arrays
Java date time
Java methods
Java file and IO operations
Java exceptions
Inner class
Java OOPs Concepts
Java Inheritance
Java Polymorphism
Java Abstraction
Java Encapsulation
Java Interface
Cohesion and Coupling
Association, Aggregation and Composition
Java Collections
Java ArrayList
Java LinkedList
Set and HashSet
LinkedHashSet and TreeSet
Queue and PriorityQueue
Deque and PriorityQueue
Java Map Interface
Java HashMap
Internal Working Of Java HashMap
Java Mutithread
Methods of Thread In Java
Join , run & Start Method in Threads
Difference b/w start & run Methods in Threads
Java Concurrency Package & its Features
CountDownLatch, CyclicBarrier, Semaphore and Mutex in Thread
Java Runtime Environment (JRE)
Java Virtual Machine (JVM)
Java overview
Java basics
Java Objects and classes
Java Constructors
Java basic datatypes
Java variable types
Java modifiers/Access Modifiers In Java
Java Basic Operators
Java Loops and Controls
Java conditions
Java numbers and characters
Java strings
Java arrays
Java date time
Java methods
Java file and IO operations
Java exceptions
Inner class
Java OOPs Concepts
Java Inheritance
Java Polymorphism
Java Abstraction
Java Encapsulation
Java Interface
Cohesion and Coupling
Association, Aggregation and Composition
Java Collections
Java ArrayList
Java LinkedList
Set and HashSet
LinkedHashSet and TreeSet
Queue and PriorityQueue
Deque and PriorityQueue
Java Map Interface
Java HashMap
Internal Working Of Java HashMap
Java Mutithread
Methods of Thread In Java
Join , run & Start Method in Threads
Difference b/w start & run Methods in Threads
Java Concurrency Package & its Features
CountDownLatch, CyclicBarrier, Semaphore and Mutex in Thread
Java Program To Validate Statement In Dictionary
Â
In this article we will write a java program to validate statements in a dictionary.
Problem statement: If we have a string statement, containing different words and another string called a dictionary containing valid words; and if all words of statement are present in the dictionary then it is valid else it is invalid.
Example 1:
String statment = "I fox am";
String disctonary = "fox I am";
Statement is valid since I, fox and am all words are in the dictionary.
Example 2:
String statment = "I am a boy";
String disctonary = "fox I am";
Statement is invalid because not all words of the statement are present in the dictionary.
Java Program To Validate Statement In Dictionary
package problems;
import java.util.*;
public class CheckValidStatmentInDict {
public static void main(String[] args)
   String statment = "I fox am";
   String disctonary = "fox I am";
   String[] statArray = statment.split(" ");
    String[] dictArray = disctonary.split(" ");
   List<String> statList = Arrays.asList(statArray);
    List<String> dictList = Arrays.asList(dictArray);
   Boolean result = true;
   for(String word: statList) {
       if(!dictList.contains(word)) {
           result = false;
           break;
       }
   }
  System.out.println(result);
}
}
Output:
True
Â
Â