Returns {@code true} if {@code node} is guaranteed to be an `Iterable` that causes no
side-effects during iteration, {@code false} otherwise.
437830
private static boolean isPureIterable(Node node) {
    switch (node.getToken()) {
      case ARRAYLIT:
      case STRING:
      case TEMPLATELIT:
        return true; // These iterables are known to be pure.
      default:
        return false; // Anything else, including a non-iterable (e.g. `null`), would be impure.
    }
  }
1013938
public static boolean isEmpty(Iterable<?> iterable)
    {
        if (iterable == null)
        {
            return true;
        }
        if (iterable instanceof RichIterable)
        {
            return ((RichIterable<?>) iterable).isEmpty();
        }
        if (iterable instanceof Collection)
        {
            return ((Collection<?>) iterable).isEmpty();
        }
        return IterableIterate.isEmpty(iterable);
    }
432195
public static boolean isNamedElement(final Node aNode) {

        final boolean isElementNode = aNode != null && aNode.getNodeType() == Node.ELEMENT_NODE;

        return isElementNode
                && getNamedAttribute(aNode, NAME_ATTRIBUTE) != null
                && !getNamedAttribute(aNode, NAME_ATTRIBUTE).isEmpty();
    }
403106
protected boolean isEquivalentInTheSet(Node node, Set<Node> set)
	{
		return set.contains(node) ||
			isEquivalentInTheSet(node, UPWARD, set) || isEquivalentInTheSet(node, DOWNWARD, set); 
	}
982113
private Boolean hasChildNodes(Node n) {
        boolean flag = n.hasChildNodes();
        if (flag && XMLUnit.getIgnoreComments()) {
            List nl = nodeList2List(n.getChildNodes());
            flag = !nl.isEmpty();
        }
        return flag ? Boolean.TRUE : Boolean.FALSE;
    }
21664
private Iterable<YamlNode> cast(Iterable<Object> nodes) {
        return () -> new UnmodifiableIterator<YamlNode>() {
            private final Iterator<Object> iter = nodes.iterator();

            @Override
            public boolean hasNext() {
                return iter.hasNext();
            }

            @Override
            public YamlNode next() {
                return (YamlNode) iter.next();
            }
        };
    }
74678
public boolean isSharable() {
        /**
         * Cache the result of {@link Sharable} annotation detection to workaround a condition. We use a
         * {@link ThreadLocal} and {@link WeakHashMap} to eliminate the volatile write/reads. Using different
         * {@link WeakHashMap} instances per {@link Thread} is good enough for us and the number of
         * {@link Thread}s are quite limited anyway.
         *
         * See <a href="https://github.com/netty/netty/issues/2289">#2289</a>.
         */
        Class<?> clazz = getClass();
        Map<Class<?>, Boolean> cache = InternalThreadLocalMap.get().handlerSharableCache();
        Boolean sharable = cache.get(clazz);
        if (sharable == null) {
            sharable = clazz.isAnnotationPresent(Sharable.class);
            cache.put(clazz, sharable);
        }
        return sharable;
    }
1082533
public static boolean mayThrowException(Node n) {
    switch (n.getToken()) {
      case CALL:
      case TAGGED_TEMPLATELIT:
      case GETPROP:
      case GETELEM:
      case THROW:
      case NEW:
      case ASSIGN:
      case INC:
      case DEC:
      case INSTANCEOF:
      case IN:
      case YIELD:
      case AWAIT:
        return true;
      case FUNCTION:
        return false;
      default:
        break;
    }
    for (Node c = n.getFirstChild(); c != null; c = c.getNext()) {
      if (!ControlFlowGraph.isEnteringNewCfgNode(c) && mayThrowException(c)) {
        return true;
      }
    }
    return false;
  }
226764
function(node){
    var nodeName = node.nodeName;
    while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false;
    return true;
  }
905015
public boolean isLeaf()
    {
        NodeData data = (NodeData)this.getUserObject();
        if (data != null)
            return data.isLeaf();
        return false;
    }
346209
public boolean contains(Node s)
  {
    runTo(-1);

    if (null == m_map)
      return false;

    for (int i = 0; i < m_firstFree; i++)
    {
      Node node = m_map[i];

      if ((null != node) && node.equals(s))
        return true;
    }

    return false;
  }
766034
public static <T> Iterable<T> simpleIterable(final Iterable<T> iterable) {
        requireNonNull(iterable);
        return () -> iterable.iterator();
    }
25132
public static boolean hasChildElement(NodeList list) {
		
		Node n;

		for(int i = 0; i < list.getLength(); i++) {
			n = list.item(i);

			if(n.getNodeType() == Node.ELEMENT_NODE) {
				return true;
			}
		}

		return false;
		
	}
1175412
private Object fromNode(final ImmutableNode node) {
        if (!node.getChildren().isEmpty()) {
            final Map<String, List<ImmutableNode>> children = getChildrenWithName(node);

            final HashMap<String, Object> map = new HashMap<>();
            for (final Map.Entry<String, List<ImmutableNode>> entry : children.entrySet()) {
                assert !entry.getValue().isEmpty();
                if (entry.getValue().size() == 1) {
                    // Just one node.
                    final ImmutableNode child = entry.getValue().get(0);
                    final Object childValue = fromNode(child);
                    map.put(entry.getKey(), childValue);
                } else {
                    // Multiple nodes.
                    final ArrayList<Object> list = new ArrayList<>();
                    for (final ImmutableNode child : entry.getValue()) {
                        final Object childValue = fromNode(child);
                        list.add(childValue);
                    }
                    map.put(entry.getKey(), list);
                }
            }
            return map;
        } else {
            return node.getValue();
        }
    }
532784
private static boolean nodeHasCall(Node node) {
    return NodeUtil.has(node, new Predicate<Node>() {
      @Override
      public boolean apply(Node input) {
        return input.isCall() || input.isNew() || input.isTaggedTemplateLit();
      }},
      NOT_FUNCTION_PREDICATE);
  }
721556
public static boolean isLhsByDestructuring(Node n) {
    switch (n.getToken()) {
      case NAME:
      case GETPROP:
      case GETELEM:
        return isLhsByDestructuringHelper(n);
      default:
        return false;
    }
  }
556809
static final boolean textNodesOnly(NodeList list) {
        final int length = list.getLength();

        for (int i = 0; i < length; i++)
            if (list.item(i).getNodeType() != Node.TEXT_NODE)
                return false;

        return true;
    }