title: Android: Hashmap or Sequence in Java
body: <p>What is more appropriate to use to implement [to create key/values and to process the input] in my application based on the reference <a href="https://stackoverflow.com/questions/41514223/android-tapping-one-to-six-buttons-continuously-one-after-another-to-string-t">---> Here &lt;---</a></p>
  
  <p>These two were provided to me by different users, so I am hoping someone could tell me what's good to use in terms of <strong>operation speed</strong> and <strong>coding efficiency</strong></p>
  
  <p>Using the <code>sequence</code>, but though I am still having hard time implementing it.</p>
  
  <pre><code>//Those are fields:
  private final List&lt;List&lt;String&gt;&gt; sequences;
  private final List&lt;String&gt; currentSequence;
  
  //This is a method you'll have to call from onCreate
  private void initSequences(){
    sequences = new ArrayList&lt;ArrayList&lt;String&gt;&gt;();
  
    sequences.add(Arrays.asList("button1")); //A
    sequences.add(Arrays.asList("button1", "button3")); //B
    sequences.add(Arrays.asList("button1", "button2")); //C
  </code></pre>
  
  <p>...}</p>
  
  <pre><code>// This goes where you do the timer thing
  currentSequence= new ArrayList&lt;String&gt;();
  // For every new timer you must add the to the list the keypress
  currentSequence.add(/*the key you registered*/);
  // When a timer finishes its time and you finished to register the keypresses, lets say we will print the output letter with a syso
  if(sequences.contains(currentSequence)){
    System.out.println( sequences.indexOf(currentSequence)+97 );
   } else {
    System.out.println( "sequence not correct" );
   }
   currentSequence.clear();
  </code></pre>
  
  <p>or using <code>map</code>, but the thing is this is just a pseudocode which was provided to me. I don't know how to implement it..</p>
  
  <pre><code>map = {[R.id.block1],'A',
  [R.id.block1, R.id.block2],'B',
  [R.id.block1, R.id.block2, R.id.block2],'C',
  etc...
  }  
  </code></pre>
  
  <p>So I have done the following steps already </p>
  
  <ul>
  <li><ol>
  <li>Collect your input data (the button taps) </li>
  </ol></li>
  <li><ol start="2">
  <li>Know when it's time to process the input</li>
  </ol></li>
  <li><ol start="3">
  <li>Then the last one to use (Map or Sequence) the processing of input.</li>
  </ol></li>
  </ul>
  
  <p>I can't get it. :( Please help. Thank you.</p>