Java 8 List - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 List class.

This code example shows how to use the following methods:add
} 
 
class AWTFrame extends Frame {
    Button button = new Button("button");
    TextArea text = new TextArea("qwerty");
    List list = new List();
 
    public AWTFrame(String title) {
        super(title);
 
        list.add("one");
        list.add("two");
        list.add("three");
 
        this.setLayout(new FlowLayout());
        this.add(button);
        this.add(text);
        this.add(list);
        this.pack();
    } 
6
CodeRank
This code example shows how to use the following methods:getSelectedIndex
            f.setVisible(true);
            // hanlde double clicking 
            MouseListener mouseListener = new MouseAdapter() {
                public void mouseClicked(MouseEvent e) {
                    if (e.getClickCount() == 2) {
                        int index = dataList.getSelectedIndex();
                        setMidiInputSelection(index, info);
                        f.setVisible(false);
                        setupMidiOutput(); 
                    } 
                } 
            }; 
            dataList.addMouseListener(mouseListener);
             
        } catch (Exception e) {
            System.out.println (e);
            System.exit (0);
        } 
    } 
     
4
CodeRank
This code example shows how to use the following methods:getSelectedItem
		list = new List(10, false);
		list.add("Hello");
		list.add("Goodbye");
		list.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent e) {
				System.out.println("Selected: " + list.getSelectedItem());
			} 
		}); 
 
		add(list);
	} 
 
	public static void main(String[] s) {
		ListDemo l = new ListDemo("Up and down the list");
		l.pack();
		l.setVisible(true);
	} 
} 
3
CodeRank
This code example shows how to use the following methods:
     
    private Note       currentNote;
    private char       currentNoteLetter = 'A';    
    private int        currentPitch = 69; 
     
    private static List  inputList = new List(8);    
                    
    public LetterNotesEditor( Frame  parentFrame ) {
        super(  
            parentFrame,                
            "Set Music Parameters", 
            true ); 
        initializeData(); 
        initializeButtons(); 
        initializeLabels(); 
        setSize(500, 300);
        placeControls(); 
        addWindowListener(this);
        setVisible(false);
        pack();
3
CodeRank
This code example shows how to use the following methods:add
        initializeData(); 
        show();
    }    
 
    private void initializeLists() { 
        noteList = new List(6);
        noteList.add( "Rest" );        
        noteList.add( "A" );        
        noteList.add( "A#" );        
        noteList.add( "B" );        
        noteList.add( "C" );        
        noteList.add( "C#" );        
        noteList.add( "D" );        
        noteList.add( "D#" );        
        noteList.add( "E" );        
        noteList.add( "F" );        
        noteList.add( "F#" );        
        noteList.add( "G" );        
        noteList.add( "G#" );        
         

0
CodeRank
See Code Examples for Java 8 List Methods: