title: How to search through arraylist containing string, int and double with JTextField and JButton
body: <p>I currently have a working GUI program that has a few buttons on it to simply step through my arraylist of items. These simply display the first, last or next and previous index results. This list has <code>String</code>, <code>int</code> and <code>double</code> inside of it. Now I have added a <code>JTextField</code> for input and a search button. My question is how do I get my search button to search through this array list? I was reading <a href="https://stackoverflow.com/questions/8377831/search-an-arraylist-by-the-contents-of-a-jtextfield-arraylist-containsjtextfi">this answer</a> but I don't understand the datum thing. Do I have to convert the entire arraylist to string before searching through it? Would something like </p>
  
  <pre><code>    ArrayList&lt;inventoryItem&gt; inventory = new ArrayList&lt;&gt;();  ....    
      JTextField input = new JTextField(18); ...
            JButton searchButton = new JButton("Search");
              searchButton.setToolTipText("Search for entry");
  
  
  searchButton.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent ae) {
                  String usrInput = input.getText();
                  for (String s : inventory) {
                      if (usrInput.contains(s)) {
                          inventory.get(currentIndex);
                          outputText.append(" somehow put whatever the index is equal to here");
  
                      }
  
                  }
  
              }
          });
  </code></pre>
  
  <p>The error I get is that <code>inventoryItem cannot be converted to string</code>. The second problem: I am having is how to I make it output everything in that index. For example my output looks like this:</p>
  
  <pre><code>class officeSupplyItem extends inventoryItem {
  
      public officeSupplyItem(String itemName, int itemNumber, int inStock, double unitPrice) {
          super(itemName, itemNumber, inStock, unitPrice);
      }
  
      @Override
      public void output(JTextArea outputText) {
          outputText.setText("Item Name = " + itemName + " \n"); //print out the item name
          outputText.append("Item Number = " + itemNumber + " \n"); //print out the item number
          outputText.append("In Stock = " + inStock + " \n"); //print out how many of the item are in stock
          outputText.append("Item Price = $" + formatted.format(unitPrice) + " \n"); //print out the price per item
          outputText.append("Restocking fee is $" + formatted.format(restockingFee) + " per item \n");
          outputText.append("Value of item inventory = $" + formatted.format(value) + " \n"); //print out the value of the item inventory
          outputText.append("Cost of inventory w/restocking fee = $" + formatted.format(inventoryValue) + " \n"); //print out the total cost of inventory with restocking fee
  
      }
  }
  </code></pre>
  
  <p>I would also like to understand what the datum portion of the mentioned link means.</p>