Java 8 EnumSet - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 EnumSet class.

This code example shows how to use the following methods:contains, size
This code example shows how to use the following methods:clone
    EnumSerializedForm(EnumSet<E> delegate) {
      this.delegate = delegate;
    } 
    Object readResolve() { 
      // EJ2 #76: Write readObject() methods defensively. 
      return new ImmutableEnumSet<E>(delegate.clone());
    } 
    private static final long serialVersionUID = 0;
  } 
} 
6
CodeRank
This code example shows how to use the following methods:remove, clone
        RopMethod resultMeth;
 
        ssaMeth = SsaConverter.convertToSsaMethod(
                this, rmeth, paramWidth, isStatic);
 
        EnumSet<OptionalStep> newSteps = steps.clone();
 
        /* 
         * CONST_COLLECTOR trades insns for registers, which is not an 
         * appropriate strategy here. 
         */ 
        newSteps.remove(OptionalStep.CONST_COLLECTOR);
 
        runSsaFormSteps(ssaMeth, newSteps);
 
        resultMeth = SsaToRop.convertToRopMethod(this, ssaMeth, true);
        return resultMeth;
    } 
 
    private void runSsaFormSteps(SsaMethod ssaMeth,
6
CodeRank
This code example shows how to use the following methods:contains, isEmpty
    return flag;
  } 
 
  public static void validate(String xAttrName, boolean xAttrExists,
      EnumSet<XAttrSetFlag> flag) throws IOException {
    if (flag == null || flag.isEmpty()) {
      throw new HadoopIllegalArgumentException("A flag must be specified."); 
    } 
 
    if (xAttrExists) {
      if (!flag.contains(REPLACE)) {
        throw new IOException("XAttr: " + xAttrName +
            " already exists. The REPLACE flag must be specified."); 
      } 
    } else { 
      if (!flag.contains(CREATE)) {
        throw new IOException("XAttr: " + xAttrName +
            " does not exist. The CREATE flag must be specified."); 
      } 
    } 
  } 
6
CodeRank
This code example shows how to use the following methods:contains, isEmpty
   * Validate the CreateFlag and throw exception if it is invalid 
   * @param flag set of CreateFlag 
   * @throws HadoopIllegalArgumentException if the CreateFlag is invalid 
   */ 
  public static void validate(EnumSet<CreateFlag> flag) {
    if (flag == null || flag.isEmpty()) {
      throw new HadoopIllegalArgumentException(flag
          + " does not specify any options"); 
    } 
    final boolean append = flag.contains(APPEND);
    final boolean overwrite = flag.contains(OVERWRITE);
     
    // Both append and overwrite is an error 
    if (append && overwrite) {
      throw new HadoopIllegalArgumentException( 
          flag + "Both append and overwrite options cannot be enabled.");
    } 
  } 
   
  /** 
6
CodeRank
This code example shows how to use the following methods:contains
    public boolean containsKey(ENUM key) {
        return true; 
    } 
 
    public boolean get(ENUM key) {
        return store.contains(key);
    } 
 
    public boolean put(ENUM key, boolean value) {
        if (value) {
            return !store.add(key);
        } else { 
            return store.remove(key);
        } 
    } 
 
    public void putAll(EnumBooleanMap<ENUM> other) {
        store.addAll(other.store);
    } 
 
5
CodeRank
This code example shows how to use the following methods:size, toArray
		private Profile(EnumSet<Feature> features) {
			this.features = features;
		} 
 
		Feature[] features() { 
			return features.toArray(new Feature[features.size()]);
		} 
 
		boolean contains(Feature feature) {
			return features.contains(feature);
		} 
	} 
 
	/** 
	 * <code>javax.el.methodInvocations</code> 
	 */ 
	public static final String PROP_METHOD_INVOCATIONS = "javax.el.methodInvocations";
 
	/** 
	 * <code>javax.el.varArgs</code> 
5
CodeRank
This code example shows how to use the following methods:contains
    return FULL;
  } 
 
  public boolean showHeaders() 
  { 
    return _errorPartsToShow.contains(ErrorResponsePart.HEADERS);
  } 
 
  public boolean showStatusCodeInBody() 
  { 
    return _errorPartsToShow.contains(ErrorResponsePart.STATUS_CODE_IN_BODY);
  } 
 
  public boolean showStacktrace() 
  { 
    return _errorPartsToShow.contains(ErrorResponsePart.STACKTRACE);
  } 
 
  public boolean showMessage() 
  { 
5
CodeRank
This code example shows how to use the following methods:contains
    private Type(Property... properties) {
      this.properties = EnumSet.copyOf(ImmutableSet.copyOf(properties));
    } 
 
    public boolean shouldWriteRecordedMetadataToDiskAfterBuilding() { 
      return properties.contains(Property.SHOULD_UPDATE_METADATA_ON_DISK) ||
          properties.contains(Property.SHOULD_CLEAR_AND_WRITE_METADATA_ON_DISK);
 
    } 
 
    public boolean shouldClearAndOverwriteMetadataOnDisk() { 
      return properties.contains(Property.SHOULD_CLEAR_AND_WRITE_METADATA_ON_DISK);
    } 
 
    public boolean shouldUploadResultingArtifact() { 
      return properties.contains(Property.SHOULD_UPLOAD_RESULTING_ARTIFACT);
    } 
  } 
 
  public BuildRuleSuccess(BuildRule rule, Type type) {
5
CodeRank
This code example shows how to use the following methods:equals, is3xxRedirection, value
			throws Exception { 
 
		String viewName = getViewName(); 
 
		if (getStatusCode() != null) { 
			if (getStatusCode().is3xxRedirection()) { 
				request.setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, getStatusCode()); 
				viewName = (viewName != null && !viewName.startsWith("redirect:") ? "redirect:" + viewName : viewName); 
			} 
			else { 
				response.setStatus(getStatusCode().value()); 
				if (isStatusOnly() || (getStatusCode().equals(HttpStatus.NO_CONTENT) && getViewName() == null)) { 
					return null; 
				} 
			} 
		} 
 
		ModelAndView modelAndView = new ModelAndView(); 
		modelAndView.addAllObjects(RequestContextUtils.getInputFlashMap(request)); 
 
8
CodeRank

Related Java 8 EnumSet Questions & Answers:

See Code Examples for Java 8 EnumSet Methods: