Package trial.gaurav.customer
Class CustomerFinder
java.lang.Object
trial.gaurav.customer.CustomerFinder
- All Implemented Interfaces:
Comparator
The `CustomerFinder` class represents a comparator to find a customer with a specific ID in a linked list of customers.
It implements the `Comparator` interface to define the find() method.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCustomerFinder(LinkedList<Customer> cRecords, int id) Constructs a new `CustomerFinder` object with the given customer records and customer ID to find. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfind()Finds a customer with the specified ID in the linked list of customers.
-
Field Details
-
customerRecords
-
customerId
private int customerId
-
-
Constructor Details
-
CustomerFinder
Constructs a new `CustomerFinder` object with the given customer records and customer ID to find.- Parameters:
cRecords- The linked list containing the customer records to search.id- The customer ID to find.
-
-
Method Details
-
find
public boolean find()Finds a customer with the specified ID in the linked list of customers.- Specified by:
findin interfaceComparator- Returns:
- True if the customer with the specified ID is found, otherwise false.
-