Validates a single item. Throws an exception if the item is invalid.

@param item The item to validate.

@return The validated item. May differ from the input item.
184853
function(item) {
        if (item && Selectivity.isValidId(item.id) && isString(item.text)) {
            return item;
        } else {
            throw new Error('Item should have id (number or string) and text (string) properties');
        }
    }
98496
public int add(T item) {
		if (itemIndex.containsKey(item)) {
			// Items can only be added once
			return itemIndex.get(item);
		}
		int index = items.size();
		itemIndex.put(item, index);
		items.add(item);
		return index;
	}
203667
public TableWriteItems addItemToPut(Item item) {
        if (item != null) {
            if (itemsToPut == null)
                itemsToPut = new ArrayList<Item>();
            this.itemsToPut.add(item);
        }
        return this;
    }
823388
public static Matcher<JsonElement> isElementValid(final Validator validator, final JsonElement element) {
        return new TypeSafeDiagnosingMatcher<JsonElement>() {
            @Override
            protected boolean matchesSafely(JsonElement item, Description mismatchDescription) {
                if (!validator.isValid(element)) {
                    mismatchDescription.appendText("element: " + element.toString() + ", does not validate by validator " + validator.getTitle());
                    return false;
                }
                return true;
            }

            @Override
            public void describeTo(Description description) {
                description.appendText("is array item valid");
            }
        };
    }
1151017
@Override
	protected boolean onSingleTapUpHelper(final int index, final Item item, final MapView mapView) {
		if (this.mFocusItemsOnTap) {
			this.mFocusedItemIndex = index;
			mapView.postInvalidate();
		}
		return this.mOnItemGestureListener.onItemSingleTapUp(index, item);
	}
674648
def _validate_enum(self, item: Any, enum: Any) -> Any:
        
        if item is None:
            result = get_random_item(enum, self.random)
        elif item and isinstance(item, enum):
            result = item
        else:
            raise NonEnumerableError(enum)

        return result.value
929788
@Override
    public int getItemType(BaseCell item) {
        // if the item is a keyType, which means item.type is not the key
        int version = mViewManager != null ? mViewManager.getViewVersion(item.stringType) : 0;
        if (!TextUtils.isEmpty(item.typeKey)) {
            // we should use getTypeKey()
            String typeKey = item.typeKey + version;
            if (!mStrKeys.containsKey(typeKey)) {
                int newType = mTypeId.getAndIncrement();
                mStrKeys.put(typeKey, newType);
                mId2Types.put(newType, item.stringType);
            }

            return mStrKeys.get(typeKey).intValue();
        } else {
            // otherwise, use item.type as identity key
            // note, this now only be executed in MainThread, atomic not actually needed
            String stringType = item.stringType + version;
            if (!mStrKeys.containsKey(stringType)) {
                int newType = mTypeId.getAndIncrement();
                mStrKeys.put(stringType, newType);
                mId2Types.put(newType, item.stringType);
            }
            return mStrKeys.get(stringType).intValue();
        }
    }
1267980
public void set(ResultItem item){
        try {
            if (item.getValueType() == ValueType.DOCUMENT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.XML;
            } else if (item.getValueType() == ValueType.ELEMENT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.XML;
            } else if (item.getValueType() == ValueType.TEXT) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.TEXT;
            } else if (item.getValueType() == ValueType.BINARY) {
                if (item.isCached()) {
                    content = ((XdmBinary) item.getItem()).asBinaryData();
                } else {
                    is = item.asInputStream();
                }
                contentType = ContentType.BINARY;
            } else if (item.getValueType() == ValueType.ARRAY_NODE ||
                item.getValueType() == ValueType.BOOLEAN_NODE ||
                item.getValueType() == ValueType.NULL_NODE ||
                item.getValueType() == ValueType.NUMBER_NODE ||
                item.getValueType() == ValueType.OBJECT_NODE) {
                content = item.asString().getBytes("UTF-8");
                contentType = ContentType.JSON;
            } else {
                contentType = ContentType.UNKNOWN;
            }
        } catch (UnsupportedEncodingException e) {
            LOG.error(e);
        }
    }
1062214
public boolean remove(ESigItem item) {
        boolean result = items.remove(item);
        
        if (result) {
            removed(item);
        }
        
        return result;
    }
238138
public void select(Item item, boolean considerSelectableFlag) {
        if (considerSelectableFlag && !item.isSelectable()) {
            return;
        }
        item.withSetSelected(true);
        if (mSelectionListener != null) {
            mSelectionListener.onSelectionChanged(item, true);
        }
    }
1093832
public synchronized void putInt(int item)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putInt", Integer.valueOf(item));

      checkValid();
      getCurrentByteBuffer(4).putInt(item);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putInt");
   }
1058917
public void add(Item item)
    {
        Item innerItem = trie.get(item.key);
        if (innerItem == null)
        {
            innerItem = item;
            trie.put(innerItem.key, innerItem);
        }
        else
        {
            innerItem.combine(item);
        }
    }
305265
public T match(I item)
    {
        Set<T> set = mapSet.get(item);
        if (set.size() == 1)
        {
            T match = set.iterator().next();
            unmap(match);
            return match;
        }
        return null;
    }
133351
private Object itemValue(Object obj, Object item) throws NoSuchMethodException,
            ClassNotFoundException, InvocationTargetException, IllegalAccessException
    {
        // String value
        if (item instanceof String) return item;

        XmlParser.Node node = (XmlParser.Node) item;
        String tag = node.getTag();
        if ("Call".equals(tag)) return call(obj, node);
        if ("Get".equals(tag)) return get(obj, node);
        if ("New".equals(tag)) return newObj(obj, node);
        if ("Ref".equals(tag)) return refObj(obj, node);
        if ("Array".equals(tag)) return newArray(obj, node);

        if ("SystemProperty".equals(tag))
        {
            String name = node.getAttribute("name");
            String defaultValue = node.getAttribute("default");
            return System.getProperty(name, defaultValue);
        }

        log.warn("Unknown value tag: " + node, new Throwable());
        return null;
    }
241144
public boolean removeItem(T item) {
        int index = mListItems.indexOf(item);
        if (index < 0) return false;
        mListItems.remove(index);
        notifyItemRemoved(index);
        return true;
    }
1169505
private void validateMandatoryItem(ItemState changedItem) throws ConstraintViolationException, AccessDeniedException
   {
      if (changedItem.getData().isNode() && (changedItem.isAdded() || changedItem.isMixinChanged())
         && !changesLog.getItemState(changedItem.getData().getQPath()).isDeleted())
      {
         // Node not in delete state. It might be a wrong
         if (!changesLog.getItemState(changedItem.getData().getIdentifier()).isDeleted())
         {
            NodeData nData = (NodeData)changedItem.getData();
            try
            {
               validateMandatoryChildren(nData);
            }
            catch (ConstraintViolationException e)
            {
               throw e;
            }
            catch (AccessDeniedException e)
            {
               throw e;
            }
            catch (RepositoryException e)
            {
               LOG.warn("Unexpected exception. Probable wrong data. Exception message:" + e.getLocalizedMessage());
            }
         }
      }
   }
815131
public static <T> List<T> create(final T item) {
        final List<T> list = new ArrayList<T>();
        list.add(item);
        return list;
    }