Returns a {@code Choice} with only one option, {@code t}.
172593
public static <T> Choice<T> of(final T t) {
    checkNotNull(t);
    return new Choice<T>() {
      @Override
      protected Iterator<T> iterator() {
        return Iterators.singletonIterator(t);
      }

      @Override
      public Optional<T> first() {
        return Optional.of(t);
      }

      @Override
      public Choice<T> condition(Predicate<? super T> predicate) {
        return predicate.apply(t) ? this : Choice.<T>none();
      }

      @Override
      public <R> Choice<R> thenChoose(Function<? super T, Choice<R>> function) {
        return function.apply(t);
      }

      @Override
      public <R> Choice<R> thenOption(Function<? super T, Optional<R>> function) {
        return fromOptional(function.apply(t));
      }

      @Override
      public <R> Choice<R> transform(Function<? super T, R> function) {
        return of(function.apply(t));
      }

      @Override
      public String toString() {
        return String.format("Choice.of(%s)", t);
      }
    };
  }
955025
public static <T, R> Optional<R> getOptionalIfExist(Optional<T> optional,
            Function<T, R> returnBuilderFunction) {
        return optional.map(returnBuilderFunction);
    }
314426
Option toOption() {
        DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();

        oBuilder.withShortName(option).withDescription(description).withRequired(required);

        if (longOptionName != null) {
            oBuilder.withLongName(longOptionName);
        }

        if (hasArgs) {
            ArgumentBuilder aBuilder = new ArgumentBuilder();

            if (argName != null) {
                aBuilder.withName(argName);
            }

            if (argsAreOptional) {
                aBuilder.withMinimum(0);
            }

            if (argsCount != null) {
                aBuilder.withMaximum(argsCount);
            } else {
                aBuilder.withMaximum(1);
            }

            if (argsValueSeparator != null && argsValueSeparator.length() != 0) {
                aBuilder.withInitialSeparator(argsValueSeparator.charAt(0));
                aBuilder.withSubsequentSeparator(argsValueSeparator.charAt(0));
            }
            oBuilder.withArgument(aBuilder.create());
        }

        return oBuilder.create();
    }
1084706
public static <T> Optional<T> toJava(Option<T> scalaOption) {
		if (scalaOption.isEmpty()) {
			return Optional.empty();
		} else {
			return Optional.ofNullable(scalaOption.get());
		}
	}
476327
public static Optional<String> getOptional(String string) {
        return Optional.ofNullable(string).filter(getIsEmpty().negate());
    }
277011
public <T> NettyChannelBuilder withOption(ChannelOption<T> option, T value) {
    channelOptions.put(option, value);
    return this;
  }
270746
public static <T> OptionType<T> of(
    final @Nullable T x)
  {
    if (x == null) {
      return None.none();
    }

    return Some.some(x);
  }
858532
final public <T> Property with(Option<T> option, T value) {
        if(value != null){
            options.addOrSet(option, value);
        }
        return this;
    }
733197
public static <T> com.google.common.base.Optional<T> toGuavaOptional(final Optional<T> optional) {
        return com.google.common.base.Optional.fromNullable(optional.orElse(null));
    }
456889
public <T> T getOrElse(ClientOption<T> option, T defaultValue) {
        return getOrElse0(option, defaultValue);
    }
177057
public static <T> Optional<T> of(T value) {
        return value == null ? (Optional<T>) EMPTY : new Optional<>(value);
    }
1019404
public boolean offer(T t) {
        boolean retval=size() < capacity && super.offer(t);
        if(waiting_takers.get() > 0) {
            lock.lock();
            try {
                not_empty.signal();
            }
            finally {
                lock.unlock();
            }
        }

        return retval;
    }
768376
public Option getOption(String opt)
    {
        opt = Util.stripLeadingHyphens(opt);

        if (shortOpts.containsKey(opt))
        {
            return shortOpts.get(opt);
        }

        return longOpts.get(opt);
    }
60730
public static <T> Option<T> some(T t) {
    return new Option.Some<T>(t);
  }
774098
function pick() {
                if (this._remainingOptions.length === 0) {
                  this._remainingOptions = clone(this._originalOptions);
                }

                var index = Math.floor(Math.random() * this._remainingOptions.length);
                return this._remainingOptions.splice(index, 1)[0];
              }
276754
public <T> T get(@NonNull String optionName) {
      optionName = optionName.replaceAll("^-+", "");
      NamedOption option = options.get(optionName);

      if (option == null) {
         return Cast.as(unamedOptions.get(optionName));
      }

      if (option.isBoolean()) {
         return option.getValue() == null ? Cast.as(Boolean.FALSE) : option.getValue();
      }

      return option.getValue();
   }
1175658
@NotNull
    @Contract(pure = true)
    @SuppressWarnings("unchecked")
    public static <T> Optional<T> empty() {
        return (Optional<T>) EMPTY;
    }