Untitled

 avatar
unknown
plain_text
3 years ago
1.3 kB
2
Indexable
public class AccountQueue {

	public static void main(String[] args) {
		// create multiple account object
		Account account1 = new Account(1001, "General Manager", "10 years", "Permanent");
		Account account2 = new Account(1002, "Project Manager", "2 years", "Contract");
		Account account3 = new Account(1003, "Engineering Manager", "4 years", "Permanent");
		Account account4 = new Account(1004, "Development Manager", "6 years", "Permanent");

		Queue<Account> queueOfAccounts = new ArrayDeque<Account>();

		queueOfAccount.add(account1); // head element
		queueOfAccount.add(account2);
		queueOfAccount.add(account3);
		queueOfAccount.add(account4);
		
		// top / peek element
		System.out.println("Head :> " + queueOfAccount.peek());
		System.out.println("Head :> " + queueOfAccount.element());
		System.out.println("----------------------------");
				
		for (Account account : queueOfAccount) {
			// System.out.println(account);
			System.out.println("--------------------");
			System.out.println("Account No : " + account.id);
			System.out.println("Employee Title : " + account.title);
			System.out.println("Employment Duration : " + account.duration);
			System.out.println("Employment Status : " + account.status);
Editor is loading...