import java.util.*; class UserProfile { int userID; String fullName; String email; String mobileNumber; String password; String role; public UserProfile(int userID, String fullName, String email, String mobileNumber, String password, String role) { this.userID = userID; this.fullName = fullName; this.email = email; this.mobileNumber = mobileNumber; this.password = password; this.role = role; } @Override public String toString() { return "UserID: " + userID + ", FullName: " + fullName + ", Email: " + email + ", MobileNumber: " + mobileNumber + ", Role: " + role; } } class Reservation { int reservationId; String checkIn, checkOut, roomType, name; long contact; public Reservation(int reservationId, String checkIn, String checkOut, String roomType, String name, long contact) { this.reservationId = reservationId; this.checkIn = checkIn; this.checkOut = checkOut; this.roomType = roomType; this.name = name; this.contact = contact; } public String toString() { return "Reservation ID: " + reservationId + ", Name: " + name + ", Check-in: " + checkIn + ", Check-out: " + checkOut + ", Room Type: " + roomType + ", Contact: " + contact; } } class Booking { public int userId; private int reservationId; public double billAmount; public Booking(int userId, int reservationId, double billAmount) { this.userId = userId; this.reservationId = reservationId; this.billAmount = billAmount; } @Override public String toString() { return "User ID: " + userId + ", Reservation ID: " + reservationId + ", Bill Amount: $" + billAmount; } } class BookingServices { int bookingID; String roomTypeSelection; String bookingDetails; double price; public BookingServices(int bookingID, String roomTypeSelection, String bookingDetails, double price) { this.bookingID = bookingID; this.roomTypeSelection = roomTypeSelection; this.bookingDetails = bookingDetails; this.price = price; } public void displayBookingService() { System.out.println("Booking ID: " + bookingID); System.out.println("Room Type: " + roomTypeSelection); System.out.println("Details: " + bookingDetails); System.out.println("Price: $" + price); System.out.println("---------------------------------"); } } class Room { int roomNumber; String roomType; String status; String dateAvailability; double price; String place; public Room(int roomNumber, String roomType, String status, String dateAvailability, double price, String place) { this.roomNumber = roomNumber; this.roomType = roomType; this.status = status; this.dateAvailability = dateAvailability; this.price = price; this.place = place; } public void displayRoomDetails() { System.out.println("Room Number: " + roomNumber); System.out.println("Room Type: " + roomType); System.out.println("Status: " + status); System.out.println("Available Date: " + dateAvailability); System.out.println("Price: $" + price); System.out.println("Place: " + place); System.out.println("--------------------------"); } public void updateRoomStatus(String newStatus, String newDateAvailability) { this.status = newStatus; this.dateAvailability = newDateAvailability; System.out.println("Room status updated successfully!"); } } class Complaint { private String userName; private long contactNumber; private String roomNumber; private String complaintType; private int feedbackRating; public Complaint(String userName, long contactNumber, String roomNumber, String complaintType, int feedbackRating) { this.userName = userName; this.contactNumber = contactNumber; this.roomNumber = roomNumber; this.complaintType = complaintType; this.feedbackRating = feedbackRating; } public void displayComplaint() { System.out.println("User Name: " + userName); System.out.println("Contact Number: " + contactNumber); System.out.println("Room Number: " + roomNumber); System.out.println("Complaint Type: " + complaintType); System.out.println("Feedback Rating: " + feedbackRating + "/5"); System.out.println("---------------------------------"); } @Override public String toString() { return "User Name: " + userName + ", Contact Number: " + contactNumber + ", Room Number: " + roomNumber + ", Complaint Type: " + complaintType + ", Feedback Rating: " + feedbackRating + "/5"; } } public class Main { static ArrayList<UserProfile> users = new ArrayList<>(); static Scanner scanner = new Scanner(System.in); static ArrayList<Reservation> reservations = new ArrayList<>(); static ArrayList<Booking> bookingHistory = new ArrayList<>(); static ArrayList<BookingServices> bookingServicesList = new ArrayList<>(); static ArrayList<Complaint> complaintList = new ArrayList<>(); static ArrayList<Room> roomList = new ArrayList<>(); static int reservationCounter = 1; static int bookingIDCounter = 1; public static void main(String[] args) { roomList.add(new Room(101, "1BHK", "Vacant", "2024-12-10", 100.0, "Downtown")); roomList.add(new Room(202, "2BHK", "Occupied", "2024-12-15", 200.0, "Uptown")); roomList.add(new Room(303, "3BHK", "Vacant", "2024-12-12", 300.0, "Midtown")); int choice; do { System.out.println("\n1. User Management"); System.out.println("2. Login"); System.out.println("3. Exit"); System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: userManagementMenu(); break; case 2: login(); break; case 3: System.out.println("Exiting..."); break; default: System.out.println("Invalid choice. Please try again."); } } while (choice != 3); } public static void userManagementMenu() { int choice; do { System.out.println("\nUser Management:"); System.out.println("1. Register New User"); System.out.println("2. Update User Details"); System.out.println("3. Delete User"); System.out.println("4. View Users"); System.out.println("5. Back to Main Menu"); System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: registerUser(); break; case 2: updateUserDetails(); break; case 3: deleteUser(); break; case 4: viewUsers(); break; case 5: System.out.println("Returning to main menu..."); break; default: System.out.println("Invalid choice. Please try again."); } } while (choice != 5); } public static void registerUser() { System.out.print("Enter UserID (Integer): "); int userID = scanner.nextInt(); scanner.nextLine(); // Consume newline character System.out.print("Enter Full Name (Max 50 characters): "); String fullName = scanner.nextLine(); System.out.print("Enter Email (Max 100 characters): "); String email = scanner.nextLine(); System.out.print("Enter Mobile Number: "); String mobileNumber = scanner.nextLine(); System.out.print("Enter Password (Max 30 characters): "); String password = scanner.nextLine(); System.out.print("Enter Role (Customer/Admin): "); String role = scanner.nextLine(); UserProfile user = new UserProfile(userID, fullName, email, mobileNumber, password, role); users.add(user); System.out.println("User Registration is successful."); } public static void updateUserDetails() { System.out.print("Enter UserID to update: "); int userID = scanner.nextInt(); scanner.nextLine(); // Consume newline character boolean userFound = false; for (UserProfile user : users) { if (user.userID == userID) { System.out.print("Enter new Email: "); String newEmail = scanner.nextLine(); user.email = newEmail; userFound = true; System.out.println("User details are updated successfully."); break; } } if (!userFound) { System.out.println("User with the given ID not found."); } } public static void deleteUser() { System.out.print("Enter UserID to delete: "); int userID = scanner.nextInt(); scanner.nextLine(); // Consume newline character boolean userFound = false; for (int i = 0; i < users.size(); i++) { if (users.get(i).userID == userID) { users.remove(i); userFound = true; System.out.println("User details are deleted."); break; } } if (!userFound) { System.out.println("User with the given ID not found."); } } public static void viewUsers() { if (users.isEmpty()) { System.out.println("No users to display."); } else { for (UserProfile user : users) { System.out.println(user); } } } public static void login() { System.out.print("Enter UserID: "); int userID = scanner.nextInt(); scanner.nextLine(); // Consume newline character System.out.print("Enter Password: "); String password = scanner.nextLine(); boolean isAuthenticated = false; for (UserProfile user : users) { if (user.userID == userID && user.password.equals(password)) { isAuthenticated = true; if (user.role.equalsIgnoreCase("Admin")) { showAdminMenu(); } else { showCustomerMenu(userID); } break; } } if (!isAuthenticated) { System.out.println("Invalid UserID or Password. Please try again."); } } public static void showCustomerMenu(int userId) { int choice; do { System.out.println("\nCustomer Menu:"); System.out.println("1. Reservation"); System.out.println("2. Booking History"); System.out.println("3. Room Status"); System.out.println("4. Check-out Billing"); System.out.println("5. Complaint"); System.out.println("6. Contact"); System.out.println("7. Log Out"); System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: reservationMenu(); break; case 2: viewBookingHistory(userId); break; case 3: displayRoomAvailability(); break; case 4: checkoutMenu(userId); break; case 5: complaintMenu(); break; case 6: contactMenu(); break; case 7: System.out.println("Logging out..."); break; default: System.out.println("Invalid choice. Please try again."); } } while (choice != 7); } public static void showAdminMenu() { int choice; do { System.out.println("\nAdmin Menu:"); System.out.println("1. Booking Hotel Services"); System.out.println("2. Booking History"); System.out.println("3. Booking History by ID"); System.out.println("4. Room Status"); System.out.println("5. Check-out Billing Invoice"); System.out.println("6. View Complaint"); System.out.println("7. Log Out"); System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: bookingServiceMenu(); break; case 2: viewAllBookings(); break; case 3: searchBookingByUser(); break; case 4: updateRoomStatus(); break; case 5: System.out.print("Enter UserID to generate an invoice: "); int checkoutUserId = scanner.nextInt(); generateInvoice(checkoutUserId); break; case 6: viewActiveComplaints(); break; case 7: System.out.println("Logging out..."); break; default: System.out.println("Invalid choice. Please try again."); } } while (choice != 7); } public static void reservationMenu() { boolean exit = false; while (!exit) { System.out.println("\nReservation Menu"); System.out.println("1. Add New Reservation"); System.out.println("2. Update Reservation"); System.out.println("3. Delete Reservation"); System.out.println("4. View All Reservations"); System.out.println("5. Exit"); System.out.print("Enter your choice: "); int choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: addNewReservation(); break; case 2: updateReservation(); break; case 3: deleteReservation(); break; case 4: viewReservations(); break; case 5: exit = true; break; default: System.out.println("Invalid choice! Try again."); } } } static void addNewReservation() { System.out.print("Enter Check-in Date (yyyy-mm-dd): "); String checkIn = scanner.nextLine(); System.out.print("Enter Check-out Date (yyyy-mm-dd): "); String checkOut = scanner.nextLine(); System.out.print("Enter Room Type (Single/Double): "); String roomType = scanner.nextLine(); System.out.print("Enter Name: "); String name = scanner.nextLine(); System.out.print("Enter Contact Number: "); long contact = scanner.nextLong(); Reservation reservation = new Reservation(reservationCounter++, checkIn, checkOut, roomType, name, contact); reservations.add(reservation); System.out.println("Reservation Successful!"); } static void updateReservation() { System.out.print("Enter Reservation ID to update: "); int reservationId = scanner.nextInt(); scanner.nextLine(); for (Reservation reservation : reservations) { if (reservation.reservationId == reservationId) { System.out.print("Enter new Name: "); String newName = scanner.nextLine(); reservation.name = newName; System.out.println("User details are updated successfully."); return; } } System.out.println("Reservation not found!"); } static void deleteReservation() { System.out.print("Enter Reservation ID to delete: "); int reservationId = scanner.nextInt(); scanner.nextLine(); // Clear buffer for (Reservation reservation : reservations) { if (reservation.reservationId == reservationId) { reservations.remove(reservation); System.out.println("Reservation details are deleted."); return; } } System.out.println("Reservation not found!"); } static void viewReservations() { System.out.println("\nAll Reservations:"); if (reservations.isEmpty()) { System.out.println("No reservations found."); } else { for (Reservation reservation : reservations) { System.out.println(reservation); } } } static void addBooking(int userId, int reservationId, double billAmount) { Booking booking = new Booking(userId, reservationId, billAmount); bookingHistory.add(booking); } static void viewBookingHistory(int userId) { if (bookingHistory.isEmpty()) { System.out.println("No previous bookings found."); } else { System.out.println("Booking History:"); for (Booking booking : bookingHistory) { if(booking.userId == userId) { System.out.println(booking); } } } } static void complaintMenu() { boolean exit = false; while (!exit) { System.out.println("\nComplaint/Feedback Menu:"); System.out.println("1. Register Complaint"); System.out.println("2. View Complaints"); System.out.println("3. Exit"); System.out.print("Enter your choice: "); int choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: System.out.print("\nEnter your name: "); String userName = scanner.nextLine(); System.out.print("Enter your contact number: "); long contactNumber = scanner.nextLong(); scanner.nextLine(); System.out.print("Enter your room number: "); String roomNumber = scanner.nextLine(); System.out.println("Select complaint type:"); System.out.println("1. Poor housekeeping"); System.out.println("2. Noisy guests"); System.out.println("3. Uncomfortable beds"); System.out.println("4. Slow service"); System.out.println("5. Lack of amenities"); System.out.println("6. Unfriendly staff"); System.out.print("Enter your choice: "); int complaintChoice = scanner.nextInt(); scanner.nextLine(); String complaintType = switch (complaintChoice) { case 1 -> "Poor housekeeping"; case 2 -> "Noisy guests"; case 3 -> "Uncomfortable beds"; case 4 -> "Slow service"; case 5 -> "Lack of amenities"; case 6 -> "Unfriendly staff"; default -> "Unknown complaint"; }; System.out.print("Enter feedback rating (1 to 5): "); int feedbackRating = scanner.nextInt(); registerComplaint(userName, contactNumber, roomNumber, complaintType, feedbackRating); break; case 2: viewComplaints(); break; case 3: exit = true; System.out.println("Exiting..."); break; default: System.out.println("Invalid choice! Try again."); } } } static void registerComplaint(String userName, long contactNumber, String roomNumber, String complaintType, int feedbackRating) { Complaint complaint = new Complaint(userName, contactNumber, roomNumber, complaintType, feedbackRating); complaintList.add(complaint); System.out.println("\nSuccessfully registered Complaint."); } static void viewComplaints() { if (complaintList.isEmpty()) { System.out.println("\nNo complaints registered yet."); } else { System.out.println("\nRegistered Complaints:"); for (Complaint complaint : complaintList) { System.out.println(complaint); } } } static void contactMenu() { boolean exit = false; while (!exit) { System.out.println("\nCustomer Support Menu:"); System.out.println("1. View Support Details"); System.out.println("2. Raise a Complaint"); System.out.println("3. Exit"); System.out.print("Enter your choice: "); int choice = scanner.nextInt(); switch (choice) { case 1: displaySupportDetails(); break; case 2: complaintMenu(); break; case 3: exit = true; System.out.println("Exiting..."); break; default: System.out.println("Invalid choice! Try again."); } } } static void displaySupportDetails() { System.out.println("\nCustomer Support Details:"); System.out.println("Contact Number: +1-800-123-4567"); System.out.println("Email: [email protected]"); System.out.println("Address: 123 Main Street, Cityville, Country"); } static void checkoutMenu(int userId) { boolean exit = false; double amount = 0; while (!exit) { System.out.println("\nCheckout Billing Menu:"); System.out.println("1. View Bill"); System.out.println("2. Pay Bill"); System.out.println("3. Cancel"); System.out.print("Enter your choice: "); int choice = scanner.nextInt(); switch (choice) { case 1: amount = generateInvoice(userId); break; case 2: payBill(amount, userId); exit = true; break; case 3: System.out.println("Checkout process canceled."); exit = true; break; default: System.out.println("Invalid choice! Please try again."); } } } static void payBill(double totalAmount, int userId) { System.out.println("\n--- Payment Page ---"); System.out.println("Total Amount: $" + totalAmount); System.out.println("Select Payment Method:"); System.out.println("1. Debit Card"); System.out.println("2. Credit Card"); System.out.print("Enter your choice: "); int paymentChoice = scanner.nextInt(); scanner.nextLine(); if (paymentChoice == 1 || paymentChoice == 2) { System.out.print("Enter cardholder name: "); String cardHolderName = scanner.nextLine(); System.out.print("Enter card number: "); String cardNumber = scanner.next(); System.out.print("Enter CVV: "); int cvv = scanner.nextInt(); System.out.print("Enter expiration date (MM/YY): "); String expiryDate = scanner.next(); System.out.println("\nProcessing payment..."); System.out.println("Payment successful! Thank you, " + cardHolderName); System.out.println("Generated Invoice :"); System.out.println("Invoice ID : " + cardNumber + cvv + expiryDate); System.out.println("Amount : " + totalAmount); addBooking(userId, userId, totalAmount); } else { System.out.println("Invalid payment method. Returning to main menu."); } } static void bookingServiceMenu() { int choice; do { System.out.println("1. Add New Booking Service"); System.out.println("2. Update Booking Service"); System.out.println("3. Delete Booking Service"); System.out.println("4. Display All Booking Services"); System.out.println("5. Exit"); System.out.print("Enter your choice: "); choice = scanner.nextInt(); scanner.nextLine(); switch (choice) { case 1: addNewBookingService(scanner); break; case 2: updateBookingService(scanner); break; case 3: deleteBookingService(scanner); break; case 4: displayAllBookingServices(); break; case 5: System.out.println("Exiting..."); break; default: System.out.println("Invalid choice! Please try again."); } } while (choice != 5); } static void addNewBookingService(Scanner scanner) { System.out.print("Enter Room Type Selection: "); String roomType = scanner.nextLine(); System.out.print("Enter Booking Details: "); String details = scanner.nextLine(); System.out.print("Enter Price: "); double price = scanner.nextDouble(); BookingServices newBooking = new BookingServices(bookingIDCounter++, roomType, details, price); bookingServicesList.add(newBooking); System.out.println("Successfully registered Booking Service."); } static void updateBookingService(Scanner scanner) { System.out.print("Enter Booking ID to update: "); int id = scanner.nextInt(); scanner.nextLine(); for (BookingServices booking : bookingServicesList) { if (booking.bookingID == id) { System.out.print("Enter new Room Type Selection: "); booking.roomTypeSelection = scanner.nextLine(); System.out.println("Booking details are updated successfully."); return; } } System.out.println("Booking ID not found!"); } static void deleteBookingService(Scanner scanner) { System.out.print("Enter Booking ID to delete: "); int id = scanner.nextInt(); for (int i = 0; i < bookingServicesList.size(); i++) { if (bookingServicesList.get(i).bookingID == id) { bookingServicesList.remove(i); System.out.println("Booking details are deleted."); return; } } System.out.println("Booking ID not found!"); } static void displayAllBookingServices() { if (bookingServicesList.isEmpty()) { System.out.println("No booking services available."); } else { for (BookingServices booking : bookingServicesList) { booking.displayBookingService(); } } } static void viewActiveComplaints() { if (complaintList.isEmpty()) { System.out.println("No active complaints found."); } else { System.out.println("Active Complaints:"); for (Complaint complaint : complaintList) { complaint.displayComplaint(); } } } static void viewAllBookings() { if (bookingHistory.isEmpty()) { System.out.println("No bookings found."); } else { for (Booking booking : bookingHistory) { System.out.println(booking); } } } static void searchBookingByUser() { System.out.print("Enter UserID to search for booking history: "); int searchUserId = scanner.nextInt(); boolean userFound = false; for (Booking booking : bookingHistory) { if (booking.userId == searchUserId) { System.out.println(booking); userFound = true; } } if (!userFound) { System.out.println("User with ID " + searchUserId + " not found."); } } static double generateInvoice(int uid) { int checkoutUserId = uid; boolean checkoutUserFound = false; double finalAmount = 0; for (UserProfile customer : users) { if (customer.userID == checkoutUserId) { checkoutUserFound = true; double totalAmount = 0; for (Booking booking : bookingHistory) { if (booking.userId == customer.userID) { System.out.println(booking); totalAmount += booking.billAmount; } } double serviceCharges = 50.00; System.out.println("\nAdditional Service Charges: $" + serviceCharges); finalAmount = totalAmount + serviceCharges; System.out.println("\n========================="); System.out.println("Total Room Charges: $" + totalAmount); System.out.println("Service Charges: $" + serviceCharges); System.out.println("Total Invoice Amount: $" + finalAmount); System.out.println("========================="); System.out.println("Invoice generated successfully!"); break; } } if (!checkoutUserFound) { System.out.println("User with ID " + checkoutUserId + " not found."); return 0; }else { return finalAmount; } } static void displayRoomAvailability() { System.out.println("Room Availability:"); for (Room room : roomList) { room.displayRoomDetails(); } } static void updateRoomStatus() { System.out.println("Enter room number to update: "); int roomNumber = scanner.nextInt(); scanner.nextLine(); for (Room room : roomList) { if (room.roomNumber == roomNumber) { System.out.println("Enter new status (Vacant/Occupied): "); String newStatus = scanner.nextLine(); System.out.println("Enter new date availability (yyyy-mm-dd): "); String newDateAvailability = scanner.nextLine(); room.updateRoomStatus(newStatus, newDateAvailability); return; } } System.out.println("Room not found."); } }
Write, Run & Share Java code online using OneCompiler's Java online compiler for free. It's one of the robust, feature-rich online compilers for Java language, running the Java LTS version 17. Getting started with the OneCompiler's Java editor is easy and fast. The editor shows sample boilerplate code when you choose language as Java and start coding.
OneCompiler's Java online editor supports stdin and users can give inputs to the programs using the STDIN textbox under the I/O tab. Using Scanner class in Java program, you can read the inputs. Following is a sample program that shows reading STDIN ( A string in this case ).
import java.util.Scanner;
class Input {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter your name: ");
String inp = input.next();
System.out.println("Hello, " + inp);
}
}
OneCompiler supports Gradle for dependency management. Users can add dependencies in the build.gradle
file and use them in their programs. When you add the dependencies for the first time, the first run might be a little slow as we download the dependencies, but the subsequent runs will be faster. Following sample Gradle configuration shows how to add dependencies
apply plugin:'application'
mainClassName = 'HelloWorld'
run { standardInput = System.in }
sourceSets { main { java { srcDir './' } } }
repositories {
jcenter()
}
dependencies {
// add dependencies here as below
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
}
Java is a very popular general-purpose programming language, it is class-based and object-oriented. Java was developed by James Gosling at Sun Microsystems ( later acquired by Oracle) the initial release of Java was in 1995. Java 17 is the latest long-term supported version (LTS). As of today, Java is the world's number one server programming language with a 12 million developer community, 5 million students studying worldwide and it's #1 choice for the cloud development.
short x = 999; // -32768 to 32767
int x = 99999; // -2147483648 to 2147483647
long x = 99999999999L; // -9223372036854775808 to 9223372036854775807
float x = 1.2;
double x = 99.99d;
byte x = 99; // -128 to 127
char x = 'A';
boolean x = true;
When ever you want to perform a set of operations based on a condition If-Else is used.
if(conditional-expression) {
// code
} else {
// code
}
Example:
int i = 10;
if(i % 2 == 0) {
System.out.println("i is even number");
} else {
System.out.println("i is odd number");
}
Switch is an alternative to If-Else-If ladder and to select one among many blocks of code.
switch(<conditional-expression>) {
case value1:
// code
break; // optional
case value2:
// code
break; // optional
...
default:
//code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition. Usually for loop is preferred when number of iterations is known in advance.
for(Initialization; Condition; Increment/decrement){
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(<condition>){
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (<condition>);
Class is the blueprint of an object, which is also referred as user-defined data type with variables and functions. Object is a basic unit in OOP, and is an instance of the class.
class
keyword is required to create a class.
class Mobile {
public: // access specifier which specifies that accessibility of class members
string name; // string variable (attribute)
int price; // int variable (attribute)
};
Mobile m1 = new Mobile();
public class Greeting {
static void hello() {
System.out.println("Hello.. Happy learning!");
}
public static void main(String[] args) {
hello();
}
}
Collection is a group of objects which can be represented as a single unit. Collections are introduced to bring a unified common interface to all the objects.
Collection Framework was introduced since JDK 1.2 which is used to represent and manage Collections and it contains:
This framework also defines map interfaces and several classes in addition to Collections.
Collection | Description |
---|---|
Set | Set is a collection of elements which can not contain duplicate values. Set is implemented in HashSets, LinkedHashSets, TreeSet etc |
List | List is a ordered collection of elements which can have duplicates. Lists are classified into ArrayList, LinkedList, Vectors |
Queue | FIFO approach, while instantiating Queue interface you can either choose LinkedList or PriorityQueue. |
Deque | Deque(Double Ended Queue) is used to add or remove elements from both the ends of the Queue(both head and tail) |
Map | Map contains key-values pairs which don't have any duplicates. Map is implemented in HashMap, TreeMap etc. |