title: Get an item by index from the HashSet array and also display the average length of each item in the list
body: <p>Hi I have created code that uses a HashSet array. I am brand new to Java programming and I would like to know how to accomplish these two tasks:</p>
  
  <p>*Get an item by index from the HashSet array
  *display the average length of each item in the list</p>
  
  <p>My code isn't long at all so I am pasting the entire code here. Thanks for all your help.</p>
  
  <pre><code>public class MainActivity extends Activity {
  
  Button aButton; // Global Scope
  Button sButton;
  TextView text2;
  EditText eText;
  HashSet&lt;String&gt; list = new HashSet&lt;String&gt;();
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.new_layout); 
  
      aButton = (Button) this.findViewById(R.id.button1);
      text2 = (TextView) this.findViewById(R.id.textView1);
  
      //Clickable Saved Input will display alert
      text2.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              Toast.makeText(getApplicationContext(), "Complete!", Toast.LENGTH_LONG).show();
  
          }
      });
  
      aButton.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
  
  
              list.add("Books");
              list.add("Newspapers");
              list.add("Magazines");
              String listString = "";
  
              for (String s : list) {
                  listString += s + " - ";
              }
              text2.setText(listString);
              }
          });
  
  
  
  
      sButton = (Button) this.findViewById(R.id.button2);
      eText = (EditText) this.findViewById(R.id.editText1);
  
      sButton.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View view) {
  
  
               //Log.v("EditText", eText.getText().toString());
              if( !list.add(eText.getText().toString()) )
              {
                  System.out.println("Not Unique Item");
                  Toast.makeText(getApplicationContext(), "Already Saved!", Toast.LENGTH_LONG).show();
              } else 
              {
                  System.out.println("Unique Entry Added");
                  Toast.makeText(getApplicationContext(), "Saved To Items.", Toast.LENGTH_LONG).show();
  
              }
  
  
          }
  
      });
  
  
      }
  
  }
  </code></pre>