If the given value is present, returns it as a single-element stream. Otherwise, returns an empty stream.
352599
public static <T> Stream<T> streamOf( Optional<T> value)
    {
    return value.map( Stream::of).orElse( Stream.empty());
    }
1190903
@CheckReturnValue
    public io.reactivex.Single<E> single() {
        return io.reactivex.Single.fromCallable(this);
    }
523999
public static boolean isEmpty (Object value) {

        if (value == null) {
            return true;
        }

        if (value.getClass() == String.class) {
            return isEmpty(value.toString());
        }

        if (value.getClass().isArray()) {
            return Array.getLength(value) == 0;
        }

        if (value instanceof Collection) {
            return ((Collection)value).size() == 0;
        }

        return false;
    }
906411
function (elements, attribute, value) {
            var foundElements = [], value = value || null;
            for (i = 0; i < elements.length; i++) {
                // If the value parameter is set, return only the
                // elements that has the given attribute value.
                if (value !== null) {
                    if (elements[i].getAttribute(attribute) === value)
                        foundElements.push(elements[i]);
                } else {
                    if (elements[i].getAttribute(attribute) !== null)
                        foundElements.push(elements[i]);
                }
            }

            return foundElements;
        }
133017
def parse_value(self, stream):
        
        if self.has_sequence(stream):
            value = self.parse_sequence(stream)
        elif self.has_set(stream):
            value = self.parse_set(stream)
        else:
            value = self.parse_simple_value(stream)

        self.skip_whitespace_or_comment(stream)

        if self.has_units(stream):
            return Units(value, self.parse_units(stream))

        return value
196463
public static <T> T nullIfEmpty(T value) throws IOException {
		return isEmpty(value) ? null : value;
	}
1059865
@Override
    public boolean containsValue(Object value) {
	// Overridden to take advantage of faster iterator
	if (value == null) {
	    for (Entry e = header.after; e != header; e = e.after)
		if (e.value == null) return true;
	}
	else {
	    for (Entry e = header.after; e != header; e = e.after)
		if (value.equals(e.value)) return true;
	}
	return false;
    }
715830
def ToStream(value):
        
        ms = StreamManager.GetStream()
        writer = BinaryWriter(ms)

        value.Serialize(writer)

        retVal = ms.getvalue()
        StreamManager.ReleaseStream(ms)

        return retVal
312249
@Override
	public boolean hasNext() {

		// iterate over input data until an element is created
		while (reader.hasNext() && nextElement == null) {

			try {
				final XMLEvent event = reader.nextEvent();

				switch (event.getEventType()) {

					case XMLEvent.START_DOCUMENT:
						startDocument();
						break;

					case XMLEvent.START_ELEMENT:
						startElement(event.asStartElement());
						break;

					case XMLEvent.END_DOCUMENT:
						endDocument();
						break;

					case XMLEvent.END_ELEMENT:
						endElement(event.asEndElement());
						break;

					case XMLEvent.CHARACTERS:
					case XMLEvent.CDATA:
						characters(event.asCharacters());
						break;

				}

			} catch (XMLStreamException strex) {
				logger.warn(strex.getMessage());
				break;
			}
		}

		// either an element has been created, or the stream is at its end
		return nextElement != null;
	}
244758
public String value() {
        if (!element.is().present() || !element.is().input()) {
            return null;
        }
        WebElement webElement = element.getWebElement();
        return webElement.getAttribute(VALUE);
    }
517259
private static Opt<Integer> data(final InputStream input,
        final Opt<Integer> data, final boolean available) throws IOException {
        final Opt<Integer> ret;
        if (data.has()) {
            ret = data;
        } else if (available && input.available() <= 0) {
            ret = new Opt.Single<>(-1);
        } else {
            ret = new Opt.Single<>(input.read());
        }
        return ret;
    }
1032078
public Stream<T> separate(final T value) {
        return filter(new Func1<T, Boolean>() {
            @Override
            public Boolean call(T it) {
                return ((it == null) ? (value != null) : !it.equals(value));
            }
        });
    }
1083631
def FromStream(cls, stream):
        

        if stream.system:
            specifier = DataStreamSelector.MatchSystemOnly
        else:
            specifier = DataStreamSelector.MatchUserOnly

        return DataStreamSelector(stream.stream_type, stream.stream_id, specifier)
521613
public static Stream<Element> stream(Element element) {
        return StreamSupport.stream(new ElementParentsIterable(element).spliterator(), false);
    }
49879
function isValueEmpty(value) {
  if (_.isUndefined(value)) {
    return true;
  }
  var canUseIsEmpty = _.isString(value) || _.isArray(value) || (_.isObject(value) && !_.isDate(value)) || false;
  if (canUseIsEmpty) {
    return _.isEmpty(value);
  }
  return (_.isNumber(value) || _.isBoolean(value) || _.isDate(value)) ? false : true;
}
123593
@SuppressWarnings("unchecked")
    static <T> Node<T> emptyNode(StreamShape shape) {
        switch (shape) {
            case REFERENCE:    return (Node<T>) EMPTY_NODE;
            case INT_VALUE:    return (Node<T>) EMPTY_INT_NODE;
            case LONG_VALUE:   return (Node<T>) EMPTY_LONG_NODE;
            case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
            default:
                throw new IllegalStateException("Unknown shape " + shape);
        }
    }
322255
def element_is_empty(elem_to_parse, element_path=None):
    

    element = get_element(elem_to_parse, element_path)

    if element is None:
        return True

    is_empty = (
        (element.text is None or not element.text.strip()) and
        (element.tail is None or not element.tail.strip()) and
        (element.attrib is None or not len(element.attrib)) and
        (not len(element.getchildren()))
    )

    return is_empty