package com.example.myapplication;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import java.util.concurrent.LinkedBlockingDeque;

public class MainActivity extends AppCompatActivity {
    LinkedBlockingDeque linkedBlockingDeque;

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        linkedBlockingDeque = new LinkedBlockingDeque();
        final TextView actionEvent = findViewById(R.id.actionEvent);
        linkedBlockingDeque.add("sai");
        linkedBlockingDeque.add("ram");
        linkedBlockingDeque.add("krishna");
        linkedBlockingDeque.add("prasad");
        linkedBlockingDeque.add("ram");
        actionEvent.setText("" + linkedBlockingDeque);
        actionEvent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                try {
                    linkedBlockingDeque.putLast("tutorialspoint.com");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                actionEvent.setText(""+linkedBlockingDeque);
            }
        });

    }

}


