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.ArrayList;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;

public class MainActivity extends AppCompatActivity {
    CopyOnWriteArrayList copyOnWriteArrayList;
    String head;

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        copyOnWriteArrayList = new CopyOnWriteArrayList<String>();
        final TextView actionEvent = findViewById(R.id.actionEvent);
        copyOnWriteArrayList.add("sai");
        copyOnWriteArrayList.add("ram");
        copyOnWriteArrayList.add("krishna");
        copyOnWriteArrayList.add("prasad");
        copyOnWriteArrayList.add("ram");
        actionEvent.setText("" + copyOnWriteArrayList);
        actionEvent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                actionEvent.setText("" +  copyOnWriteArrayList.contains("prasad"));
            }
        });

    }

}


