Contoh Arraydeque

import java.util.ArrayDeque;

class Main {
    public static void main(String[] args) {
        ArrayDeque<String> fruits= new ArrayDeque<>();

        // Using add()
        fruits.add("Apple");

        // Using addFirst()
        fruits.addFirst("Banana");

        // Using addLast()
        fruits.addLast("Mango");
        System.out.println("ArrayDeque: " + fruits);
    }
}
Outrageous Ostrich