code: private boolean itemInItemStateList(List<ItemState> list, String itemId, int state)
     {
        boolean retval = false;
        for (ItemState itemState : list)
        {
           if (itemState.getState() == state && itemState.getData().getIdentifier().equals(itemId))
           {
              retval = true;
              break;
           }
        }
  
        return retval;
     }
docs: Return true if the itemstate for item with <code>itemId</code> UUId exist in
  <code>List&lt;ItemState&gt;</code> list.
  
  @param list
  @param itemId
  @param state
  @return