Collection and Generics
Collection and Generics
import java.util.TreeMap;
import java.util.Scanner;
displayWordFrequency(wordFrequency);
int totalWordCount = 0;
sentence = sentence.toLowerCase();
word = removeSpecialCharacters(word);
if (!word.isEmpty()) {
totalWordCount++;
}
}
wordFrequency.put("TotalWords", totalWordCount);
return wordFrequency;
return word;
wordFrequency.remove("TotalWords");
}
STOCK LIST
import java.util.ArrayList;
import java.util.Scanner;
sc.nextLine();
while(noOfStocks-->0){
list.add(stock);
System.out.println(list);
}
Plip event
import java.util.Map;
import java.util.HashMap;
public StudentUtility(){
return studentMap;
this.studentMap = studentMap;
this.studentMap.put(studentName,score);
int count = 0;
for(Map.Entry<String,Double> entry:studentMap.entrySet()){
return count;
Main function
import java.util.Scanner;
while(noOfStudents-->0){
stuUtil.addStudentDetails(name,score);
}else{
System.out.println("Count is "+count);
Main function
import java.util.Scanner;
sc.nextLine();
for(int i=0;i<noOfVehicles;i++){
sc.nextLine();
vehUtil.addVehiclePriceDetails(name,price);
}
while(true){
if(discountedPrice == -1){
return;
sc.nextLine();
if(choice.equals("N")){
return;
import java.util.HashMap;
import java.util.Map;
return vehicleMap;
this.vehicleMap = vehicleMap;
this.vehicleMap.put(vehicleName,price);
double discountValue = 0;
else discountValue = 7;
return (vehiclePrice)-(discountValue*vehiclePrice/100.0);