title: How to get item index from ComboBox?
body: <p>I have <code>ObservableList&lt;Fruits&gt; fruits</code>. Each fruit object has name and value parameters. Objects are: {"apples", 22}, {"oranges", 3} and {"pears", 5}. I added those items to <code>ComboBox</code>: </p>
  
  <pre><code>fruitComboBox.setItems(fruits);
  </code></pre>
  
  <p>How can I get item index from this <code>ComboBox</code> based on object's name? For example get index of "oranges" object?</p>
  
  <p>I need to get index of item, so that I can use:</p>
  
  <pre><code>fruitComboBox.getSelectionModel.select(index);
  </code></pre>
  
  <p>full code will look like:</p>
  
  <pre><code>fruitComboBox.setItems(fruits);
  
  fruitFactory = lv -&gt; new ListCell&lt;Fruits&gt;){
       @Override
       protected void updateItem(Fruits fruit, boolean empty) {
          super.updateItem(fruit, empty);
          setText(empty ? "" : fruit.getName + ": " + fruit.getValue);
       }
  };
  
  fruitComboBox.setCellFactory(fruitFactory);
  fruitComboBox.setButtonCell(fruitFactory.call(null));
  </code></pre>
  
  <p>For different people I need to select by default different fruits. I tried using:</p>
  
  <pre><code>fruitComboBox.getSelectionModel().select(orangeObject);
  </code></pre>
  
  <p>But it showed not formatted object in <code>ButtonCell</code>, also it didn't have any selection in open <code>ComboBox</code>. Using index gave perfect results:</p>
  
  <pre><code>fruitComboBox.getSelectionModel().select(2);
  </code></pre>
  
  <p>The only problem is, I don't know how I can get index of item in the <code>ComboBox</code> based on one of its parameters.</p>