   @Override
   public MethodSource<Body> addMethod()
   {
      final MethodSource<Body> m = new MethodImpl<>(this);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

   @Override
   public MethodSource<Body> addMethod()
   {
      final MethodSource<Body> m = new MethodImpl<Body>(this);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

Replace Generic With Diamond MethodImpl<Body> with MethodImpl<> in method public addMethod() : MethodSource<Body> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public MethodSource<Body> addMethod(final String method)
   {
      final MethodSource<Body> m = new MethodImpl<>(this, method);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

   @Override
   public MethodSource<Body> addMethod(final String method)
   {
      final MethodSource<Body> m = new MethodImpl<Body>(this, method);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

Replace Generic With Diamond MethodImpl<Body> with MethodImpl<> in method public addMethod(method String) : MethodSource<Body> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public MethodSource<Body> addMethod(java.lang.reflect.Method method)
   {
      final MethodSource<Body> m = new MethodImpl<>(this, method);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

   @Override
   public MethodSource<Body> addMethod(java.lang.reflect.Method method)
   {
      final MethodSource<Body> m = new MethodImpl<Body>(this, method);
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

Replace Generic With Diamond MethodImpl<Body> with MethodImpl<> in method public addMethod(method Method) : MethodSource<Body> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public MethodSource<Body> addMethod(Method<?, ?> method)
   {
      MethodSource<Body> m = new MethodImpl<>(this, method.toString());
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

   @Override
   public MethodSource<Body> addMethod(Method<?, ?> method)
   {
      MethodSource<Body> m = new MethodImpl<Body>(this, method.toString());
      getBody().bodyDeclarations().add(m.getInternal());
      return m;
   }

Replace Generic With Diamond MethodImpl<Body> with MethodImpl<> in method public addMethod(method Method<?,?>) : MethodSource<Body> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public List<JavaSource<?>> getNestedTypes()
   {
      final JavaEnumImpl parentImpl = (JavaEnumImpl) javaEnum;
      Document document = parentImpl.document;
      CompilationUnit unit = parentImpl.unit;

      final List<JavaSource<?>> result = new ArrayList<>();

      final List<BodyDeclaration> bodyDeclarations = getBody().bodyDeclarations();
      for (BodyDeclaration body : bodyDeclarations)
      {
         final List<AbstractTypeDeclaration> declarations = getNestedDeclarations(body);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.add(JavaParserImpl.getJavaSource(this, document, unit, declaration));
         }
      }
      return result;
   }

   @Override
   public List<JavaSource<?>> getNestedTypes()
   {
      final JavaEnumImpl parentImpl = (JavaEnumImpl) javaEnum;
      Document document = parentImpl.document;
      CompilationUnit unit = parentImpl.unit;

      final List<JavaSource<?>> result = new ArrayList<JavaSource<?>>();

      final List<BodyDeclaration> bodyDeclarations = getBody().bodyDeclarations();
      for (BodyDeclaration body : bodyDeclarations)
      {
         final List<AbstractTypeDeclaration> declarations = getNestedDeclarations(body);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.add(JavaParserImpl.getJavaSource(this, document, unit, declaration));
         }
      }
      return result;
   }

Replace Generic With Diamond ArrayList<JavaSource<?>> with ArrayList<> in method public getNestedTypes() : List<JavaSource<?>> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   private List<AbstractTypeDeclaration> getNestedDeclarations(BodyDeclaration body)
   {
      final TypeDeclarationFinderVisitor typeDeclarationFinder = new TypeDeclarationFinderVisitor();
      body.accept(typeDeclarationFinder);
      final List<AbstractTypeDeclaration> declarations = typeDeclarationFinder.getTypeDeclarations();

      final List<AbstractTypeDeclaration> result = new ArrayList<>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current enum constant body's declaration.
         final AbstractTypeDeclaration first = declarations.remove(0);
         result.remove(first);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
      }
      return result;
   }

   private List<AbstractTypeDeclaration> getNestedDeclarations(BodyDeclaration body)
   {
      final TypeDeclarationFinderVisitor typeDeclarationFinder = new TypeDeclarationFinderVisitor();
      body.accept(typeDeclarationFinder);
      final List<AbstractTypeDeclaration> declarations = typeDeclarationFinder.getTypeDeclarations();

      final List<AbstractTypeDeclaration> result = new ArrayList<AbstractTypeDeclaration>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current enum constant body's declaration.
         final AbstractTypeDeclaration first = declarations.remove(0);
         result.remove(first);
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
      }
      return result;
   }

Replace Generic With Diamond ArrayList<AbstractTypeDeclaration> with ArrayList<> in method private getNestedDeclarations(body BodyDeclaration) : List<AbstractTypeDeclaration> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public JavaDocSource<Body> getJavaDoc()
   {
      BodyDeclaration body = getFirstBodyDeclaration();
      Javadoc javadoc = body.getJavadoc();
      if (javadoc == null)
      {
         javadoc = body.getAST().newJavadoc();
         body.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>(this, javadoc);
   }

   @Override
   public JavaDocSource<Body> getJavaDoc()
   {
      BodyDeclaration body = getFirstBodyDeclaration();
      Javadoc javadoc = body.getJavadoc();
      if (javadoc == null)
      {
         javadoc = body.getAST().newJavadoc();
         body.setJavadoc(javadoc);
      }
      return new JavaDocImpl<Body>(this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<Body> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<Body> from class org.jboss.forge.roaster.model.impl.EnumConstantBodyImpl


   @Override
   public List<String> getConstructorArguments()
   {
      final List<String> result = new ArrayList<>();
      for (Object o : enumConstant.arguments())
      {
         result.add(o.toString());
      }
      return Collections.unmodifiableList(result);
   }

   @Override
   public List<String> getConstructorArguments()
   {
      final List<String> result = new ArrayList<String>();
      for (Object o : enumConstant.arguments())
      {
         result.add(o.toString());
      }
      return Collections.unmodifiableList(result);
   }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getConstructorArguments() : List<String> from class org.jboss.forge.roaster.model.impl.EnumConstantImpl


   @Override
   public JavaDocSource<EnumConstantSource> getJavaDoc()
   {
      Javadoc javadoc = enumConstant.getJavadoc();
      if (javadoc == null)
      {
         javadoc = enumConstant.getAST().newJavadoc();
         enumConstant.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>(this, javadoc);
   }

   @Override
   public JavaDocSource<EnumConstantSource> getJavaDoc()
   {
      Javadoc javadoc = enumConstant.getJavadoc();
      if (javadoc == null)
      {
         javadoc = enumConstant.getAST().newJavadoc();
         enumConstant.setJavadoc(javadoc);
      }
      return new JavaDocImpl<EnumConstantSource>(this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<EnumConstantSource> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<EnumConstantSource> from class org.jboss.forge.roaster.model.impl.EnumConstantImpl


   @Override
   public Type<O> getType()
   {
      return new TypeImpl<>(parent, field.getStructuralProperty(FieldDeclaration.TYPE_PROPERTY));
   }

   @Override
   public Type<O> getType()
   {
      return new TypeImpl<O>(parent, field.getStructuralProperty(FieldDeclaration.TYPE_PROPERTY));
   }

Replace Generic With Diamond TypeImpl<O> with TypeImpl<> in method public getType() : Type<O> from class org.jboss.forge.roaster.model.impl.FieldImpl


   @Override
   public JavaDocSource<FieldSource<O>> getJavaDoc()
   {
      Javadoc javadoc = field.getJavadoc();
      if (javadoc == null)
      {
         javadoc = field.getAST().newJavadoc();
         field.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>(this, javadoc);
   }

   @Override
   public JavaDocSource<FieldSource<O>> getJavaDoc()
   {
      Javadoc javadoc = field.getJavadoc();
      if (javadoc == null)
      {
         javadoc = field.getAST().newJavadoc();
         field.setJavadoc(javadoc);
      }
      return new JavaDocImpl<FieldSource<O>>(this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<FieldSource<O>> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<FieldSource<O>> from class org.jboss.forge.roaster.model.impl.FieldImpl


   @Override
   public Set<String> getTagNames()
   {
      Set<String> tagNames = new LinkedHashSet<>();
      List<TagElement> tagList = javadoc.tags();
      for (TagElement tagElement : tagList)
      {
         String tagName = tagElement.getTagName();
         if (tagName != null)
            tagNames.add(tagName);
      }
      return tagNames;
   }

   @Override
   public Set<String> getTagNames()
   {
      Set<String> tagNames = new LinkedHashSet<String>();
      List<TagElement> tagList = javadoc.tags();
      for (TagElement tagElement : tagList)
      {
         String tagName = tagElement.getTagName();
         if (tagName != null)
            tagNames.add(tagName);
      }
      return tagNames;
   }

Replace Generic With Diamond LinkedHashSet<String> with LinkedHashSet<> in method public getTagNames() : Set<String> from class org.jboss.forge.roaster.model.impl.JavaDocImpl


   @Override
   public List<JavaDocTag> getTags()
   {
      List<JavaDocTag> tags = new ArrayList<>();
      List<TagElement> tagElements = javadoc.tags();
      for (TagElement tagElement : tagElements)
      {
         if (tagElement.getTagName() != null)
            tags.add(new JavaDocTagImpl(tagElement));
      }
      return tags;
   }

   @Override
   public List<JavaDocTag> getTags()
   {
      List<JavaDocTag> tags = new ArrayList<JavaDocTag>();
      List<TagElement> tagElements = javadoc.tags();
      for (TagElement tagElement : tagElements)
      {
         if (tagElement.getTagName() != null)
            tags.add(new JavaDocTagImpl(tagElement));
      }
      return tags;
   }

Replace Generic With Diamond ArrayList<JavaDocTag> with ArrayList<> in method public getTags() : List<JavaDocTag> from class org.jboss.forge.roaster.model.impl.JavaDocImpl


   @Override
   public List<JavaDocTag> getTags(String tagName)
   {
      Assert.notNull(tagName, TAG_NAME_CANNOT_BE_NULL);
      List<JavaDocTag> tags = new ArrayList<>();
      List<TagElement> tagElements = javadoc.tags();
      for (TagElement tagElement : tagElements)
      {
         if (tagName.equals(tagElement.getTagName()))
            tags.add(new JavaDocTagImpl(tagElement));
      }
      return tags;
   }

   @Override
   public List<JavaDocTag> getTags(String tagName)
   {
      Assert.notNull(tagName, TAG_NAME_CANNOT_BE_NULL);
      List<JavaDocTag> tags = new ArrayList<JavaDocTag>();
      List<TagElement> tagElements = javadoc.tags();
      for (TagElement tagElement : tagElements)
      {
         if (tagName.equals(tagElement.getTagName()))
            tags.add(new JavaDocTagImpl(tagElement));
      }
      return tags;
   }

Replace Generic With Diamond ArrayList<JavaDocTag> with ArrayList<> in method public getTags(tagName String) : List<JavaDocTag> from class org.jboss.forge.roaster.model.impl.JavaDocImpl


   @Override
   public List<MethodSource<JavaInterfaceSource>> getMethods()
   {
      List<MethodSource<JavaInterfaceSource>> result = new ArrayList<>();

      MethodFinderVisitor methodFinderVisitor = new MethodFinderVisitor();
      body.accept(methodFinderVisitor);

      List<MethodDeclaration> methods = methodFinderVisitor.getMethods();
      for (MethodDeclaration methodDeclaration : methods)
      {
         result.add(new JavaInterfaceMethodImpl(this, methodDeclaration));
      }
      return Collections.unmodifiableList(result);
   }

   @Override
   public List<MethodSource<JavaInterfaceSource>> getMethods()
   {
      List<MethodSource<JavaInterfaceSource>> result = new ArrayList<MethodSource<JavaInterfaceSource>>();

      MethodFinderVisitor methodFinderVisitor = new MethodFinderVisitor();
      body.accept(methodFinderVisitor);

      List<MethodDeclaration> methods = methodFinderVisitor.getMethods();
      for (MethodDeclaration methodDeclaration : methods)
      {
         result.add(new JavaInterfaceMethodImpl(this, methodDeclaration));
      }
      return Collections.unmodifiableList(result);
   }

Replace Generic With Diamond ArrayList<MethodSource<JavaInterfaceSource>> with ArrayList<> in method public getMethods() : List<MethodSource<JavaInterfaceSource>> from class org.jboss.forge.roaster.model.impl.JavaInterfaceImpl


   @Override
   public Type<O> getReturnType()
   {
      if (isConstructor())
      {
         return null;
      }
      return new TypeImpl<>(parent, method.getReturnType2());
   }

   @Override
   public Type<O> getReturnType()
   {
      if (isConstructor())
      {
         return null;
      }
      return new TypeImpl<O>(parent, method.getReturnType2());
   }

Replace Generic With Diamond TypeImpl<O> with TypeImpl<> in method public getReturnType() : Type<O> from class org.jboss.forge.roaster.model.impl.MethodImpl


   @Override
   public List<String> getThrownExceptions()
   {
      ArrayList<String> result = new ArrayList<>();
      List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);

      for (Object object : list)
      {
         result.add(object.toString());
      }

      return result;
   }

   @Override
   public List<String> getThrownExceptions()
   {
      ArrayList<String> result = new ArrayList<String>();
      List<?> list = (List<?>) method.getStructuralProperty(MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY);

      for (Object object : list)
      {
         result.add(object.toString());
      }

      return result;
   }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getThrownExceptions() : List<String> from class org.jboss.forge.roaster.model.impl.MethodImpl


   @Override
   @SuppressWarnings("unchecked")
   public TypeVariableSource<O> getTypeVariable(String name)
   {
      List<TypeParameter> typeParameters = method.typeParameters();
      for (TypeParameter typeParameter : typeParameters)
      {
         if (Strings.areEqual(name, typeParameter.getName().getIdentifier()))
         {
            return new TypeVariableImpl<>(parent, typeParameter);
         }
      }
      return null;
   }

   @Override
   @SuppressWarnings("unchecked")
   public TypeVariableSource<O> getTypeVariable(String name)
   {
      List<TypeParameter> typeParameters = method.typeParameters();
      for (TypeParameter typeParameter : typeParameters)
      {
         if (Strings.areEqual(name, typeParameter.getName().getIdentifier()))
         {
            return new TypeVariableImpl<O>(parent, typeParameter);
         }
      }
      return null;
   }

Replace Generic With Diamond TypeVariableImpl<O> with TypeVariableImpl<> in method public getTypeVariable(name String) : TypeVariableSource<O> from class org.jboss.forge.roaster.model.impl.MethodImpl


   @SuppressWarnings("unchecked")
   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeParameter tp2 = method.getAST().newTypeParameter();
      method.typeParameters().add(tp2);
      return new TypeVariableImpl<>(parent, tp2);
   }

   @SuppressWarnings("unchecked")
   @Override
   public TypeVariableSource<O> addTypeVariable()
   {
      TypeParameter tp2 = method.getAST().newTypeParameter();
      method.typeParameters().add(tp2);
      return new TypeVariableImpl<O>(parent, tp2);
   }

Replace Generic With Diamond TypeVariableImpl<O> with TypeVariableImpl<> in method public addTypeVariable() : TypeVariableSource<O> from class org.jboss.forge.roaster.model.impl.MethodImpl


   @Override
   public JavaDocSource<MethodSource<O>> getJavaDoc()
   {
      Javadoc javadoc = method.getJavadoc();
      if (javadoc == null)
      {
         javadoc = method.getAST().newJavadoc();
         method.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>(this, javadoc);
   }

   @Override
   public JavaDocSource<MethodSource<O>> getJavaDoc()
   {
      Javadoc javadoc = method.getJavadoc();
      if (javadoc == null)
      {
         javadoc = method.getAST().newJavadoc();
         method.setJavadoc(javadoc);
      }
      return new JavaDocImpl<MethodSource<O>>(this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<MethodSource<O>> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<MethodSource<O>> from class org.jboss.forge.roaster.model.impl.MethodImpl


   @Override
   public List<? extends Annotation<O>> getAnnotations()
   {
      List<Annotation<O>> annotations = new ArrayList<>();
      FieldSource<O> field = getField();
      if (field != null)
      {
         List<AnnotationSource<O>> fieldAnnotations = field.getAnnotations();
         annotations.addAll(fieldAnnotations);
      }
      MethodSource<O> accessor = getAccessor();
      if (accessor != null)
      {
         List<AnnotationSource<O>> accessorAnnotations = accessor.getAnnotations();
         annotations.addAll(accessorAnnotations);
      }
      MethodSource<O> mutator = getMutator();
      if (mutator != null)
      {
         List<AnnotationSource<O>> mutatorAnnotations = mutator.getAnnotations();
         annotations.addAll(mutatorAnnotations);
      }
      return annotations;
   }

   @Override
   public List<? extends Annotation<O>> getAnnotations()
   {
      List<Annotation<O>> annotations = new ArrayList<Annotation<O>>();
      FieldSource<O> field = getField();
      if (field != null)
      {
         List<AnnotationSource<O>> fieldAnnotations = field.getAnnotations();
         annotations.addAll(fieldAnnotations);
      }
      MethodSource<O> accessor = getAccessor();
      if (accessor != null)
      {
         List<AnnotationSource<O>> accessorAnnotations = accessor.getAnnotations();
         annotations.addAll(accessorAnnotations);
      }
      MethodSource<O> mutator = getMutator();
      if (mutator != null)
      {
         List<AnnotationSource<O>> mutatorAnnotations = mutator.getAnnotations();
         annotations.addAll(mutatorAnnotations);
      }
      return annotations;
   }

Replace Generic With Diamond ArrayList<Annotation<O>> with ArrayList<> in method public getAnnotations() : List<? extends Annotation<O>> from class org.jboss.forge.roaster.model.impl.PropertyImpl


   @Override
   @SuppressWarnings("unchecked")
   public FieldSource<O> addField()
   {
      FieldSource<O> field = new FieldImpl<>((O) this);
      addField(field);
      return field;
   }

   @Override
   @SuppressWarnings("unchecked")
   public FieldSource<O> addField()
   {
      FieldSource<O> field = new FieldImpl<O>((O) this);
      addField(field);
      return field;
   }

Replace Generic With Diamond FieldImpl<O> with FieldImpl<> in method public addField() : FieldSource<O> from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   @SuppressWarnings("unchecked")
   public FieldSource<O> addField(final String declaration)
   {
      String stub = "public class Stub { " + declaration + " }";
      JavaClassSource temp = (JavaClassSource) Roaster.parse(stub);
      List<FieldSource<JavaClassSource>> fields = temp.getFields();
      FieldSource<O> result = null;
      for (FieldSource<JavaClassSource> stubField : fields)
      {
         Object variableDeclaration = stubField.getInternal();
         FieldSource<O> field = new FieldImpl<>((O) this, variableDeclaration, true);
         addField(field);
         if (result == null)
         {
            result = field;
         }
      }
      return result;
   }

   @Override
   @SuppressWarnings("unchecked")
   public FieldSource<O> addField(final String declaration)
   {
      String stub = "public class Stub { " + declaration + " }";
      JavaClassSource temp = (JavaClassSource) Roaster.parse(stub);
      List<FieldSource<JavaClassSource>> fields = temp.getFields();
      FieldSource<O> result = null;
      for (FieldSource<JavaClassSource> stubField : fields)
      {
         Object variableDeclaration = stubField.getInternal();
         FieldSource<O> field = new FieldImpl<O>((O) this, variableDeclaration, true);
         addField(field);
         if (result == null)
         {
            result = field;
         }
      }
      return result;
   }

Replace Generic With Diamond FieldImpl<O> with FieldImpl<> in method public addField(declaration String) : FieldSource<O> from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   public List<MemberSource<O, ?>> getMembers()
   {
      List<MemberSource<O, ?>> result = new ArrayList<>();

      result.addAll(getFields());
      result.addAll(getMethods());

      return result;
   }

   @Override
   public List<MemberSource<O, ?>> getMembers()
   {
      List<MemberSource<O, ?>> result = new ArrayList<MemberSource<O, ?>>();

      result.addAll(getFields());
      result.addAll(getMethods());

      return result;
   }

Replace Generic With Diamond ArrayList<MemberSource<O,?>> with ArrayList<> in method public getMembers() : List<MemberSource<O,?>> from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   public O implementInterface(JavaInterface<?> type)
   {
      O obj = addInterface(type);

      if (type instanceof JavaInterfaceSource)
      {
         Set<Import> usedImports = new HashSet<>();

         JavaInterfaceSource interfaceSource = (JavaInterfaceSource) type;
         for (MethodSource<JavaInterfaceSource> method : interfaceSource.getMethods())
         {
            if (method.isDefault())
            {
               // Do not add default implementations
               continue;
            }

            if (!method.isReturnTypeVoid())
            {
               usedImports.add(interfaceSource.getImport(method.getReturnType().getQualifiedName()));
            }

            for (ParameterSource<JavaInterfaceSource> parameter : method.getParameters())
            {
               usedImports.add(interfaceSource.getImport(parameter.getType().getQualifiedName()));
            }
         }

         for (Import imprt : interfaceSource.getImports())
         {
            if (usedImports.contains(imprt))
            {
               addImport(imprt);
            }
         }
      }

      for (MethodSource<?> methodSource : Methods.implementAbstractMethods(type, this))
      {
         methodSource.setPublic().addAnnotation(Override.class);
      }
      return obj;
   }

   @Override
   public O implementInterface(JavaInterface<?> type)
   {
      O obj = addInterface(type);

      if (type instanceof JavaInterfaceSource)
      {
         Set<Import> usedImports = new HashSet<Import>();

         JavaInterfaceSource interfaceSource = (JavaInterfaceSource) type;
         for (MethodSource<JavaInterfaceSource> method : interfaceSource.getMethods())
         {
            if (method.isDefault())
            {
               // Do not add default implementations
               continue;
            }

            if (!method.isReturnTypeVoid())
            {
               usedImports.add(interfaceSource.getImport(method.getReturnType().getQualifiedName()));
            }

            for (ParameterSource<JavaInterfaceSource> parameter : method.getParameters())
            {
               usedImports.add(interfaceSource.getImport(parameter.getType().getQualifiedName()));
            }
         }

         for (Import imprt : interfaceSource.getImports())
         {
            if (usedImports.contains(imprt))
            {
               addImport(imprt);
            }
         }
      }

      for (MethodSource<?> methodSource : Methods.implementAbstractMethods(type, this))
      {
         methodSource.setPublic().addAnnotation(Override.class);
      }
      return obj;
   }

Replace Generic With Diamond HashSet<Import> with HashSet<> in method public implementInterface(type JavaInterface<?>) : O from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   public final PropertySource<O> addProperty(String type, String name)
   {
      Assert.isFalse(hasProperty(name), "Cannot create existing property " + name);

      O origin = getOrigin();
      if (origin.requiresImport(type))
      {
         origin.addImport(type);
      }
      for (String genericType : Types.splitGenerics(type))
      {
         if (origin.requiresImport(genericType))
         {
            origin.addImport(genericType);
         }
      }
      final org.jboss.forge.roaster.model.Type<O> typeObject = new TypeImpl<>(getOrigin(), null,
               Types.toSimpleName(type));
      final PropertySource<O> result = new PropertyImpl<O>(name, getOrigin())
      {
         @Override
         public org.jboss.forge.roaster.model.Type<O> getType()
         {
            final org.jboss.forge.roaster.model.Type<O> result = super.getType();
            return result == null ? typeObject : result;
         }
      };

      if (!isInterface())
      {
         result.createField();
      }
      result.setAccessible(true);
      result.setMutable(!isEnum());

      return getProperty(name);
   }

   @Override
   public final PropertySource<O> addProperty(String type, String name)
   {
      Assert.isFalse(hasProperty(name), "Cannot create existing property " + name);

      O origin = getOrigin();
      if (origin.requiresImport(type))
      {
         origin.addImport(type);
      }
      for (String genericType : Types.splitGenerics(type))
      {
         if (origin.requiresImport(genericType))
         {
            origin.addImport(genericType);
         }
      }
      final org.jboss.forge.roaster.model.Type<O> typeObject = new TypeImpl<O>(getOrigin(), null,
               Types.toSimpleName(type));
      final PropertySource<O> result = new PropertyImpl<O>(name, getOrigin())
      {
         @Override
         public org.jboss.forge.roaster.model.Type<O> getType()
         {
            final org.jboss.forge.roaster.model.Type<O> result = super.getType();
            return result == null ? typeObject : result;
         }
      };

      if (!isInterface())
      {
         result.createField();
      }
      result.setAccessible(true);
      result.setMutable(!isEnum());

      return getProperty(name);
   }

Replace Generic With Diamond TypeImpl<O> with TypeImpl<> in method public addProperty(type String, name String) : PropertySource<O> from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   public final PropertySource<O> getProperty(String name)
   {
      Assert.notNull(name, "name is null");
      final PropertyImpl<O> result = new PropertyImpl<>(name, getOrigin());
      return result.isValid() ? result : null;
   }

   @Override
   public final PropertySource<O> getProperty(String name)
   {
      Assert.notNull(name, "name is null");
      final PropertyImpl<O> result = new PropertyImpl<O>(name, getOrigin());
      return result.isValid() ? result : null;
   }

Replace Generic With Diamond PropertyImpl<O> with PropertyImpl<> in method public getProperty(name String) : PropertySource<O> from class org.jboss.forge.roaster.model.impl.AbstractJavaSourceMemberHolder


   @Override
   public JavaDocSource<JavaPackageInfoSource> getJavaDoc()
   {
      Javadoc javadoc = pkg.getJavadoc();
      if (javadoc == null)
      {
         javadoc = pkg.getAST().newJavadoc();
         pkg.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>(this, javadoc);
   }

   @Override
   public JavaDocSource<JavaPackageInfoSource> getJavaDoc()
   {
      Javadoc javadoc = pkg.getJavadoc();
      if (javadoc == null)
      {
         javadoc = pkg.getAST().newJavadoc();
         pkg.setJavadoc(javadoc);
      }
      return new JavaDocImpl<JavaPackageInfoSource>(this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<JavaPackageInfoSource> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<JavaPackageInfoSource> from class org.jboss.forge.roaster.model.impl.JavaPackageInfoImpl


   @Override
   public List<SyntaxError> getSyntaxErrors()
   {
      List<SyntaxError> result = new ArrayList<>();

      IProblem[] problems = unit.getProblems();
      if (problems != null)
      {
         for (IProblem problem : problems)
         {
            result.add(new SyntaxErrorImpl(this, problem));
         }
      }
      return result;
   }

   @Override
   public List<SyntaxError> getSyntaxErrors()
   {
      List<SyntaxError> result = new ArrayList<SyntaxError>();

      IProblem[] problems = unit.getProblems();
      if (problems != null)
      {
         for (IProblem problem : problems)
         {
            result.add(new SyntaxErrorImpl(this, problem));
         }
      }
      return result;
   }

Replace Generic With Diamond ArrayList<SyntaxError> with ArrayList<> in method public getSyntaxErrors() : List<SyntaxError> from class org.jboss.forge.roaster.model.impl.JavaSourceImpl


   @Parameters(name = "{2} {1}.{3}")
   public static List<Object[]> createParameters()
   {
      final List<Object[]> parameters = new ArrayList<>();
      parameters.add(new Object[] { JavaClassSource.class, "MockClass", String.class, "field",
               EnumSet.of(PropertyComponent.FIELD) });
      parameters.add(new Object[] { JavaEnumSource.class, "MockEnum", String.class, "field",
               EnumSet.of(PropertyComponent.FIELD) });
      parameters.add(new Object[] { JavaInterfaceSource.class, "MockInterface", int.class, "count",
               EnumSet.of(PropertyComponent.ACCESSOR) });
      parameters.add(new Object[] { JavaInterfaceSource.class, "BigInterface", boolean.class, "verbose",
               EnumSet.of(PropertyComponent.ACCESSOR, PropertyComponent.MUTATOR) });
      return parameters;
   }

   @Parameters(name = "{2} {1}.{3}")
   public static List<Object[]> createParameters()
   {
      final List<Object[]> parameters = new ArrayList<Object[]>();
      parameters.add(new Object[] { JavaClassSource.class, "MockClass", String.class, "field",
               EnumSet.of(PropertyComponent.FIELD) });
      parameters.add(new Object[] { JavaEnumSource.class, "MockEnum", String.class, "field",
               EnumSet.of(PropertyComponent.FIELD) });
      parameters.add(new Object[] { JavaInterfaceSource.class, "MockInterface", int.class, "count",
               EnumSet.of(PropertyComponent.ACCESSOR) });
      parameters.add(new Object[] { JavaInterfaceSource.class, "BigInterface", boolean.class, "verbose",
               EnumSet.of(PropertyComponent.ACCESSOR, PropertyComponent.MUTATOR) });
      return parameters;
   }

Replace Generic With Diamond ArrayList<Object[]> with ArrayList<> in method public createParameters() : List<Object[]> from class org.jboss.forge.test.roaster.model.PropertiesTest


   @Override
   public List<Import> getImports()
   {
      List<Import> results = new ArrayList<>();

      for (ImportDeclaration i : (List<ImportDeclaration>) unit.imports())
      {
         results.add(new ImportImpl(this, i));
      }

      return Collections.unmodifiableList(results);
   }

   @Override
   public List<Import> getImports()
   {
      List<Import> results = new ArrayList<Import>();

      for (ImportDeclaration i : (List<ImportDeclaration>) unit.imports())
      {
         results.add(new ImportImpl(this, i));
      }

      return Collections.unmodifiableList(results);
   }

Replace Generic With Diamond ArrayList<Import> with ArrayList<> in method public getImports() : List<Import> from class org.jboss.forge.roaster.model.impl.AbstractJavaSource


   private List<WildcardImportResolver> getImportResolvers()
   {
      if (resolvers == null)
      {
         resolvers = new ArrayList<>();
         for (WildcardImportResolver r : ServiceLoader.load(WildcardImportResolver.class, getClass().getClassLoader()))
         {
            resolvers.add(r);
         }
      }
      if (resolvers.isEmpty())
      {
         throw new IllegalStateException("No instances of [" + WildcardImportResolver.class.getName()
                  + "] were found on the classpath.");
      }
      return resolvers;
   }

   private List<WildcardImportResolver> getImportResolvers()
   {
      if (resolvers == null)
      {
         resolvers = new ArrayList<WildcardImportResolver>();
         for (WildcardImportResolver r : ServiceLoader.load(WildcardImportResolver.class, getClass().getClassLoader()))
         {
            resolvers.add(r);
         }
      }
      if (resolvers.isEmpty())
      {
         throw new IllegalStateException("No instances of [" + WildcardImportResolver.class.getName()
                  + "] were found on the classpath.");
      }
      return resolvers;
   }

Replace Generic With Diamond ArrayList<WildcardImportResolver> with ArrayList<> in method private getImportResolvers() : List<WildcardImportResolver> from class org.jboss.forge.roaster.model.impl.AbstractJavaSource


   @Override
   public List<JavaSource<?>> getNestedTypes()
   {
      List<AbstractTypeDeclaration> declarations = getNestedDeclarations(body);

      List<JavaSource<?>> result = new ArrayList<>();
      for (AbstractTypeDeclaration declaration : declarations)
      {
         result.add(JavaParserImpl.getJavaSource(this, document, unit, declaration));
      }
      return result;
   }

   @Override
   public List<JavaSource<?>> getNestedTypes()
   {
      List<AbstractTypeDeclaration> declarations = getNestedDeclarations(body);

      List<JavaSource<?>> result = new ArrayList<JavaSource<?>>();
      for (AbstractTypeDeclaration declaration : declarations)
      {
         result.add(JavaParserImpl.getJavaSource(this, document, unit, declaration));
      }
      return result;
   }

Replace Generic With Diamond ArrayList<JavaSource<?>> with ArrayList<> in method public getNestedTypes() : List<JavaSource<?>> from class org.jboss.forge.roaster.model.impl.AbstractJavaSource


   @Override
   public JavaDocSource<O> getJavaDoc()
   {
      Javadoc javadoc = body.getJavadoc();
      if (javadoc == null)
      {
         javadoc = body.getAST().newJavadoc();
         body.setJavadoc(javadoc);
      }
      return new JavaDocImpl<>((O) this, javadoc);
   }

   @Override
   public JavaDocSource<O> getJavaDoc()
   {
      Javadoc javadoc = body.getJavadoc();
      if (javadoc == null)
      {
         javadoc = body.getAST().newJavadoc();
         body.setJavadoc(javadoc);
      }
      return new JavaDocImpl<O>((O) this, javadoc);
   }

Replace Generic With Diamond JavaDocImpl<O> with JavaDocImpl<> in method public getJavaDoc() : JavaDocSource<O> from class org.jboss.forge.roaster.model.impl.AbstractJavaSource


   private List<AbstractTypeDeclaration> getNestedDeclarations(BodyDeclaration body)
   {
      TypeDeclarationFinderVisitor typeDeclarationFinder = new TypeDeclarationFinderVisitor();
      body.accept(typeDeclarationFinder);
      List<AbstractTypeDeclaration> declarations = typeDeclarationFinder.getTypeDeclarations();

      List<AbstractTypeDeclaration> result = new ArrayList<>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current class' declaration.
         result.remove(declarations.remove(0));
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
      }

      return result;
   }

   private List<AbstractTypeDeclaration> getNestedDeclarations(BodyDeclaration body)
   {
      TypeDeclarationFinderVisitor typeDeclarationFinder = new TypeDeclarationFinderVisitor();
      body.accept(typeDeclarationFinder);
      List<AbstractTypeDeclaration> declarations = typeDeclarationFinder.getTypeDeclarations();

      List<AbstractTypeDeclaration> result = new ArrayList<AbstractTypeDeclaration>(declarations);
      if (!declarations.isEmpty())
      {
         // We don't want to return the current class' declaration.
         result.remove(declarations.remove(0));
         for (AbstractTypeDeclaration declaration : declarations)
         {
            result.removeAll(getNestedDeclarations(declaration));
         }
      }

      return result;
   }

Replace Generic With Diamond ArrayList<AbstractTypeDeclaration> with ArrayList<> in method private getNestedDeclarations(body BodyDeclaration) : List<AbstractTypeDeclaration> from class org.jboss.forge.roaster.model.impl.AbstractJavaSource


   private <E extends AnnotationTargetSource<O, T>> boolean hasAnnotation(final E target, final List<?> modifiers,
            final String type)
   {
      for (Object object : modifiers)
      {
         if (object instanceof org.eclipse.jdt.core.dom.Annotation)
         {
            AnnotationSource<O> annotation = new AnnotationImpl<>(target, object);
            String annotationType = annotation.getName();
            if (Types.areEquivalent(type, annotationType))
            {
               return true;
            }
         }
      }
      return false;
   }

   private <E extends AnnotationTargetSource<O, T>> boolean hasAnnotation(final E target, final List<?> modifiers,
            final String type)
   {
      for (Object object : modifiers)
      {
         if (object instanceof org.eclipse.jdt.core.dom.Annotation)
         {
            AnnotationSource<O> annotation = new AnnotationImpl<O, T>(target, object);
            String annotationType = annotation.getName();
            if (Types.areEquivalent(type, annotationType))
            {
               return true;
            }
         }
      }
      return false;
   }

Replace Generic With Diamond AnnotationImpl<O,T> with AnnotationImpl<> in method private hasAnnotation(target E, modifiers List<?>, type String) : boolean from class org.jboss.forge.roaster.model.ast.AnnotationAccessor


   private List<Modifier> getModifiers(ASTNode body)
   {
      List<Modifier> result = new ArrayList<>();
      List<?> modifiers = getInternalModifiers(body);
      for (Object m : modifiers)
      {
         if (m instanceof Modifier)
         {
            Modifier mod = (Modifier) m;
            result.add(mod);
         }
      }
      return result;
   }

   private List<Modifier> getModifiers(ASTNode body)
   {
      List<Modifier> result = new ArrayList<Modifier>();
      List<?> modifiers = getInternalModifiers(body);
      for (Object m : modifiers)
      {
         if (m instanceof Modifier)
         {
            Modifier mod = (Modifier) m;
            result.add(mod);
         }
      }
      return result;
   }

Replace Generic With Diamond ArrayList<Modifier> with ArrayList<> in method private getModifiers(body ASTNode) : List<Modifier> from class org.jboss.forge.roaster.model.ast.ModifierAccessor


   public List<Modifier> clearVisibility(ASTNode body)
   {
      List<Modifier> modifiers = getModifiers(body);

      List<Modifier> toBeRemoved = new ArrayList<>();
      for (Modifier modifier : modifiers)
      {
         if (modifier.isPrivate() || modifier.isProtected() || modifier.isPublic())
         {
            toBeRemoved.add(modifier);
         }
      }

      getInternalModifiers(body).removeAll(toBeRemoved);
      return modifiers;
   }

   public List<Modifier> clearVisibility(ASTNode body)
   {
      List<Modifier> modifiers = getModifiers(body);

      List<Modifier> toBeRemoved = new ArrayList<Modifier>();
      for (Modifier modifier : modifiers)
      {
         if (modifier.isPrivate() || modifier.isProtected() || modifier.isPublic())
         {
            toBeRemoved.add(modifier);
         }
      }

      getInternalModifiers(body).removeAll(toBeRemoved);
      return modifiers;
   }

Replace Generic With Diamond ArrayList<Modifier> with ArrayList<> in method public clearVisibility(body ASTNode) : List<Modifier> from class org.jboss.forge.roaster.model.ast.ModifierAccessor


   /**
    * Format the given Java source {@link File} using the given Eclipse code format properties {@link File}.
    *
    * @param prefs the format properties file
    * @param source the file which contains the source to format
    * @throws FormatterException if the source coudn't be formatted
    * @throws IOException When the file cannot be read or written, or the preferences cannot be read.
    */
   public static void format(File prefs, File source) throws IOException
   {
      Properties options = readConfig(prefs);
      if (options == null)
         options = readConfigInternal();

      try (InputStream in = new BufferedInputStream(new FileInputStream(source));
               OutputStream out = new BufferedOutputStream(new FileOutputStream(source)))
      {
         String content = Streams.toString(in);
         String formatted = format(options, content);
         Streams.write(new ByteArrayInputStream(formatted.getBytes()), out);
      }
   }

   /**
    * Format the given Java source {@link File} using the given Eclipse code format properties {@link File}.
    *
    * @throws IOException When the file cannot be read or written, or the preferences cannot be read.
    */
   public static void format(File prefs, File source) throws IOException
   {
      Properties options = readConfig(prefs);
      if (options == null)
         options = readConfigInternal();

      InputStream in = null;
      OutputStream out = null;
      try
      {
         in = new BufferedInputStream(new FileInputStream(source));
         String content = Streams.toString(in);
         String formatted = format(options, content);

         out = new BufferedOutputStream(new FileOutputStream(source));
         Streams.write(new ByteArrayInputStream(formatted.getBytes()), out);
      }
      finally
      {
         Streams.closeQuietly(in);
         Streams.closeQuietly(out);
      }

   }

Try With Resources try(InputStream in=new BufferedInputStream(new FileInputStream(source)); OutputStream out=new BufferedOutputStream(new FileOutputStream(source))) in method public format(prefs File, source File) : void from class org.jboss.forge.roaster.model.util.Formatter


   private static Properties readConfig(File prefs) throws IOException
   {
      if (prefs != null)
      {
         try (InputStream stream = new BufferedInputStream(new FileInputStream(prefs)))
         {
            Properties config;
            if (prefs.getName().toLowerCase().endsWith(".xml"))
            {
               config = parseXmlConfig(stream);
            }
            else
            {
               config = parseConfig(stream);
            }
            return applyShadedPackageName(config);
         }
         catch (IOException e)
         {
            throw new IOException("Error reading preferences file: ["
                     + prefs.getAbsolutePath() + "]", e);
         }
      }

      return null;
   }

   private static Properties readConfig(File prefs) throws IOException
   {
      if (prefs != null)
      {
         InputStream stream = new BufferedInputStream(new FileInputStream(prefs));
         try
         {
            Properties config;
            if (prefs.getName().toLowerCase().endsWith(".xml"))
            {
               config = parseXmlConfig(stream);
            }
            else
            {
               config = parseConfig(stream);
            }
            return applyShadedPackageName(config);
         }
         catch (IOException e)
         {
            throw new IOException("Error reading preferences file: ["
                     + prefs.getAbsolutePath() + "]", e);
         }
         finally
         {
            Streams.closeQuietly(stream);
         }
      }

      return null;
   }

Try With Resources try(InputStream stream=new BufferedInputStream(new FileInputStream(prefs))) in method private readConfig(prefs File) : Properties from class org.jboss.forge.roaster.model.util.Formatter


   private static List<JavaParser> getParsers()
   {
      synchronized (Roaster.class)
      {
         if (parsers == null || parsers.isEmpty())
         {
            parsers = new ArrayList<>();
            for (JavaParser p : ServiceLoader.load(JavaParser.class, Roaster.class.getClassLoader()))
            {
               parsers.add(p);
            }
         }
         if (parsers.isEmpty())
         {
            throw new IllegalStateException("No instances of [" + JavaParser.class.getName()
                     + "] were found on the classpath.");
         }
      }
      return parsers;
   }

   private static List<JavaParser> getParsers()
   {
      synchronized (Roaster.class)
      {
         if (parsers == null || parsers.isEmpty())
         {
            parsers = new ArrayList<JavaParser>();
            for (JavaParser p : ServiceLoader.load(JavaParser.class, Roaster.class.getClassLoader()))
            {
               parsers.add(p);
            }
         }
         if (parsers.isEmpty())
         {
            throw new IllegalStateException("No instances of [" + JavaParser.class.getName()
                     + "] were found on the classpath.");
         }
      }
      return parsers;
   }

Replace Generic With Diamond ArrayList<JavaParser> with ArrayList<> in method private getParsers() : List<JavaParser> from class org.jboss.forge.roaster.Roaster


   private static List<FormatterProvider> getFormatters()
   {
      synchronized (Roaster.class)
      {
         if (formatters == null || formatters.isEmpty())
         {
            formatters = new ArrayList<>();
            for (FormatterProvider p : ServiceLoader.load(FormatterProvider.class, Roaster.class.getClassLoader()))
            {
               formatters.add(p);
            }
         }
         if (formatters.isEmpty())
         {
            throw new IllegalStateException("No instances of [" + FormatterProvider.class.getName()
                     + "] were found on the classpath.");
         }
      }
      return formatters;
   }

   private static List<FormatterProvider> getFormatters()
   {
      synchronized (Roaster.class)
      {
         if (formatters == null || formatters.isEmpty())
         {
            formatters = new ArrayList<FormatterProvider>();
            for (FormatterProvider p : ServiceLoader.load(FormatterProvider.class, Roaster.class.getClassLoader()))
            {
               formatters.add(p);
            }
         }
         if (formatters.isEmpty())
         {
            throw new IllegalStateException("No instances of [" + FormatterProvider.class.getName()
                     + "] were found on the classpath.");
         }
      }
      return formatters;
   }

Replace Generic With Diamond ArrayList<FormatterProvider> with ArrayList<> in method private getFormatters() : List<FormatterProvider> from class org.jboss.forge.roaster.Roaster


    public void printInfo(Printer printer) {
        LOGGER.info("Printing order");
        try (DeliveryOrderFileWriter orderWriter = new DeliveryOrderFileWriter("orders.txt")) {
            // Створення об'єктів і виклик конструкторів
            DeliveryOrder order = createNewOrder();

            // Визначення вартості доставки
            double cost = deliveryCostCalculator.calculateDeliveryCost(order);

            // Запис основної інформації в файл
            printer.printInfo();

            LOGGER.info("Printing delivery order details");
            LOGGER.info("Delivery cost: " + cost);
        } catch (ObjectNotFoundExeption e) {
            LOGGER.error(e.getMessage());
        } catch (IOException e) {
            LOGGER.error("Error reading and writing to file in DeliveryService class" + e.getMessage());
        }
    }

    @Override
    public void printInfo() {
        LOGGER.info("Printing order info into console");
        try {
            // Створення об'єктів і виклик конструкторів
            DeliveryOrder order = createNewOrder();

            // Визначення вартості доставки
            double cost = deliveryCostCalculator.calculateDeliveryCost(order);

            // Виведення основної інформації
            System.out.printf(order.toString());
            System.out.println("Delivery cost: " + cost);
            LOGGER.info("Printing delivery order details");
            LOGGER.info("Delivery cost: " + cost);
        } catch (ObjectNotFoundExeption e) {
            LOGGER.error(e.getMessage());
        }
    }

Try With Resources try(DeliveryOrderFileWriter orderWriter=new DeliveryOrderFileWriter("orders.txt")) in method public printInfo(printer Printer) : void from class com.solvd.laba.block1.task2_oop.DeliveryService


    private void mostrarListaEventos(ListView<Evento> listaEventosMes){
        listaEventosMes.setCellFactory(event -> new ListCell<>() {
            @Override
            protected void updateItem(Evento evento, boolean empty) {
                super.updateItem(evento, empty);
                if (empty || evento == null) {
                    setText(null);
                } else {
                    setText("Evento:" + "\n" + "Título: " + evento.obtenerTitulo() + "\n" +
                            "Descripción: " + evento.obtenerDescripcion() + "\n" +
                            "Fecha de Inicio: " + evento.obtenerFechaInicio() + "\n" +
                            "Fecha Fin: " + evento.obtenerFechaFin() + "\n" +
                            "Tipo de repeticion: " + evento.obtenerTipoRepeticion() + "\n" +
                            "Alamas:" + evento.obtenerAlarmasEvento() + "\n");
                }
            }
        });
        listaEventosMes.setOnMouseClicked(event -> {
            Evento eventoSeleccionado = listaEventosMes.getSelectionModel().getSelectedItem();
            if (eventoSeleccionado != null) {
                mostrarDetallesEvento(eventoSeleccionado);
            }

        });

    }

    private void mostrarListaEventosMes(ListView<Evento> listaEventosMes){
        listaEventosMes.setCellFactory(event -> new ListCell<Evento>() {
            @Override
            protected void updateItem(Evento evento, boolean empty) {
                super.updateItem(evento, empty);
                if (empty || evento == null) {
                    setText(null);
                } else {
                    setText("Evento:" + "\n" + "Título: " + evento.obtenerTitulo() + "\n" +
                            "Descripción: " + evento.obtenerDescripcion() + "\n" +
                            "Fecha de Inicio: " + evento.obtenerFechaInicio() + "\n" +
                            "Fecha Fin: " + evento.obtenerFechaFin() + "\n" +
                            "Tipo de repeticion: " + evento.obtenerTipoRepeticion() + "\n" +
                            "Alamas:" + evento.obtenerAlarmasEvento() + "\n");
                }
            }
        });
        listaEventosMes.setOnMouseClicked(event -> {
            Evento eventoSeleccionado = listaEventosMes.getSelectionModel().getSelectedItem();
            if (eventoSeleccionado != null) {
                mostrarDetallesEvento(eventoSeleccionado);
            }

        });

    }

Replace Generic With Diamond ListCell<Evento> with ListCell<> in method private mostrarListaEventos(listaEventosMes ListView<Evento>) : void from class GUIVista


    private void mostrarListaTareas(ListView<Tarea> listaTareasMes){
        listaTareasMes.setCellFactory(task -> new ListCell<>() {
            @Override
            protected void updateItem(Tarea tarea, boolean empty) {
                super.updateItem(tarea, empty);
                if (empty || tarea == null) {
                    setText(null);
                } else {
                    setText("Tarea:" + "\n" + "Título: " + tarea.obtenerTitulo() + "\n" +
                            "Descripción: " + tarea.obtenerDescripcion() + "\n" +
                            "Fecha de Inicio: " + tarea.obtenerFechaInicio() + "\n" +
                            "Fecha de Vencimiento: " + tarea.obtenerFechaVencimiento() + "\n" +
                            "Esta completa:" + tarea.estaCompleta() + "\n" +
                            "Es de dia completo: " + (tarea.getClass()) + "\n" +
                            "Alamas:" + tarea.obtenerAlarmas() + "\n");
                }
            }
        });

        listaTareasMes.setOnMouseClicked(event -> {
            Tarea tareaSeleccionada = listaTareasMes.getSelectionModel().getSelectedItem();
            if (tareaSeleccionada != null) {
                mostrarDetallesTarea(tareaSeleccionada);
            }

        });
    }

    private void mostrarListaTareasMes(ListView<Tarea> listaTareasMes){
        listaTareasMes.setCellFactory(task -> new ListCell<Tarea>() {
            @Override
            protected void updateItem(Tarea tarea, boolean empty) {
                super.updateItem(tarea, empty);
                if (empty || tarea == null) {
                    setText(null);
                } else {
                    setText("Tarea:" + "\n" + "Título: " + tarea.obtenerTitulo() + "\n" +
                            "Descripción: " + tarea.obtenerDescripcion() + "\n" +
                            "Fecha de Inicio: " + tarea.obtenerFechaInicio() + "\n" +
                            "Fecha de Vencimiento: " + tarea.obtenerFechaVencimiento() + "\n" +
                            "Esta completa:" + tarea.estaCompleta() + "\n" +
                            "Es de dia completo: " + (tarea.getClass()) + "\n" +
                            "Alamas:" + tarea.obtenerAlarmas() + "\n");
                }
            }
        });

        listaTareasMes.setOnMouseClicked(event -> {
            Tarea tareaSeleccionada = listaTareasMes.getSelectionModel().getSelectedItem();
            if (tareaSeleccionada != null) {
                mostrarDetallesTarea(tareaSeleccionada);
            }

        });
    }

Replace Generic With Diamond ListCell<Tarea> with ListCell<> in method private mostrarListaTareas(listaTareasMes ListView<Tarea>) : void from class GUIVista


    public Tarea(String titulo, String descripcion)
    {
        this.titulo = titulo;
        this.descripcion = descripcion;
        this.estaCompleta = false;
        this.id = idSiguiente++;
        this.alarmas = new ArrayList<>();
    }

    public Tarea(String titulo, String descripcion)
    {
        this.titulo = titulo;
        this.descripcion = descripcion;
        this.estaCompleta = false;
        this.id = idSiguiente++;
        this.alarmas = new ArrayList<Alarma>();
    }

Replace Generic With Diamond ArrayList<Alarma> with ArrayList<> in method public Tarea(titulo String, descripcion String) from class Tarea


    @Override
    public ResourceGroupPriority Create() {

        ResourceGroupPriority resourceGroupPriority = new ResourceGroupPriority();

        Queue<ResourceGroupPriorities> priorityQueue = new LinkedList<>();

        PriorityQueuePlaceModel firstPrio = queueModel.getPriorityQueuePlaces().stream().filter(e -> e.getParentId() == 0).findFirst().get();

        priorityQueue.add(Convert(firstPrio.getElementId()));

        PriorityQueuePlaceModel curr = firstPrio;

        for (int i = 0; i < queueModel.getPriorityQueuePlaces().size(); i++) {

            if (curr.getParentId() != 0)
                priorityQueue.add(Convert(curr.getElementId()));

            PriorityQueuePlaceModel finalCurr = curr;

            if(curr.getChildId() != 0)
            curr = queueModel.getPriorityQueuePlaces().stream().filter(e -> e.getElementId() == finalCurr.getChildId()).findFirst().get();
        }

        resourceGroupPriority.SetQueue(priorityQueue);
        return resourceGroupPriority;
    }

    @Override
    public ResourceGroupPriority Create() {

        ResourceGroupPriority resourceGroupPriority = new ResourceGroupPriority();

        PriorityQueue<ResourceGroupPriorities> priorityQueue = new PriorityQueue<ResourceGroupPriorities>();

        PriorityQueuePlaceModel firstPrio = queueModel.getPriorityQueuePlaces().stream().filter(e -> e.getParentId() == 0).findFirst().get();

        priorityQueue.add(Convert(firstPrio.getElementId()));

        PriorityQueuePlaceModel curr = firstPrio;

        for (int i = 0; i < queueModel.getPriorityQueuePlaces().size(); i++) {

            if (curr.getParentId() != 0)
                priorityQueue.add(Convert(curr.getElementId()));

            PriorityQueuePlaceModel finalCurr = curr;

            if(curr.getChildId() != 0)
            curr = queueModel.getPriorityQueuePlaces().stream().filter(e -> e.getElementId() == finalCurr.getChildId()).findFirst().get();
        }

        resourceGroupPriority.SetQueue(priorityQueue);
        return resourceGroupPriority;
    }

Replace Generic With Diamond PriorityQueue<ResourceGroupPriorities> with LinkedList<> in method public Create() : ResourceGroupPriority from class factory.priority.ResourceGroupFactory


    public Board(int numOfPlayers, BagOfCards bag) {
        this.numOfPlayers = numOfPlayers;
        this.bag = bag;
        this.board = new HashMap<>();
        this.fill();
    }

    public Board(int numOfPlayers, BagOfCards bag) {
        this.numOfPlayers = numOfPlayers;
        this.bag = bag;
        this.board = new HashMap<Coordinates, Card>();
        this.fill();
    }

Replace Generic With Diamond HashMap<Coordinates,Card> with HashMap<> in method public Board(numOfPlayers int, bag BagOfCards) from class org.polimi.server.model.Board


    public void connect() throws InterruptedException {
        ChannelFuture cf = proxyServerBootstrap.connect(host, port);
        executor.execute(() -> {
            while (!success) {
                try {
                    TimeUnit.SECONDS.sleep(1);
                    if (!success) {
                        LOGGER.info("Connection wait");
                    }
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        cf.addListener((ChannelFutureListener) future -> {
            Channel channel = future.channel();
            if (future.isSuccess()) {
                LOGGER.info("Successful connection");
                // Reset
                success = true;
                errorTimes.set(0);
                // Login
                String value = ProxyConfig.client().getKey();
                NettyMessage message = new NettyMessage();
                message.setHeader(new Header().setType(MessageType.LOGIN_REQUEST));
                message.setBody(value);
                channel.writeAndFlush(message);

            } else {
                LOGGER.info("Connection failure");
                channel.eventLoop().schedule(() -> {
                    LOGGER.info("Try retry connection");
                    try {
                        connect();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }, delay(), TimeUnit.MILLISECONDS);
                success = false;
                errorTimes.incrementAndGet();
            }
        });
        cf.channel().closeFuture().sync();
    }

    public void connect() throws InterruptedException {
        ChannelFuture cf = proxyServerBootstrap.connect(host, port);
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (!success) {
                    try {
                        TimeUnit.SECONDS.sleep(1);
                        if (!success) {
                            LOGGER.info("Connection wait");
                        }
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        });

        cf.addListener(new ChannelFutureListener() {

            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                Channel channel = future.channel();
                if (future.isSuccess()) {
                    LOGGER.info("Successful connection");
                    // Reset
                    success = true;
                    errorTimes.set(0);
                    // Login
                    String value = ProxyConfig.client().getKey();
                    NettyMessage message = new NettyMessage();
                    message.setHeader(new Header().setType(MessageType.LOGIN_REQUEST));
                    message.setBody(value);
                    channel.writeAndFlush(message);

                } else {
                    LOGGER.info("Connection failure");
                    channel.eventLoop().schedule(() -> {
                        LOGGER.info("Try retry connection");
                        try {
                            connect();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }, delay(), TimeUnit.MILLISECONDS);
                    success = false;
                    errorTimes.incrementAndGet();
                }
            }
        });
        cf.channel().closeFuture().sync();
    }

Replace Anonymous With Lambda org.github.ponking66.ClientApplication.connect.execute.new Runnable with () -> {while(!success){tryTimeUnit.SECONDS.sleep(1); in method public connect() : void from class org.github.ponking66.ClientApplication


    public void bind(Channel targetServerChannel, Channel cmdChannel, String userId) {
        // 建立隧道
        proxyServerBootstrap.connect(ProxyConfig.getServerHost(), ProxyConfig.getServerPort())
                .addListener((ChannelFutureListener) future -> {
                    // 连接成功
                    Channel proxyServerChannel = future.channel();
                    if (future.isSuccess()) {
                        // 绑定方法
                        Consumer<Channel> success = channel -> {
                            // 绑定关系
                            LOGGER.info("Connect proxy server success.");
                            // 两个通道绑定关系
                            proxyServerChannel.attr(AttrConstants.BIND_CHANNEL).set(targetServerChannel);
                            targetServerChannel.attr(AttrConstants.BIND_CHANNEL).set(proxyServerChannel);
                            // 通知代理服务器，隧道已经打通
                            ProxyTunnelInfoResp resp = new ProxyTunnelInfoResp();
                            resp.setUserId(userId);
                            resp.setToken(ProxyConfig.client().getKey());
                            NettyMessage proxyMessage = new NettyMessage();
                            proxyMessage.setHeader(new Header().setType(MessageType.CONNECT_RESPONSE));
                            proxyMessage.setBody(resp);
                            proxyServerChannel.writeAndFlush(proxyMessage);
                            // 重新注册和目标服务器通道的读事件
                            targetServerChannel.config().setOption(ChannelOption.AUTO_READ, true);
                            // 根据唯一标示缓存通道
                            ClientChannelManager.addTargetServerChannel(userId, targetServerChannel);
                            // 为通道绑定唯一标示
                            ClientChannelManager.setTargetServerChannelUserId(targetServerChannel, userId);
                        };
                        // 绑定方法
                        Consumer<Channel> failed = channel -> {
                            NettyMessage proxyMessage = new NettyMessage();
                            proxyMessage.setHeader(new Header().setType(MessageType.DISCONNECT));
                            proxyMessage.setBody(userId);
                            cmdChannel.writeAndFlush(proxyMessage);
                        };
                        borrowProxyChanel(proxyServerBootstrap, success, failed);
                    } else {
                        LOGGER.warn("Connect proxy server failed.", future.cause());
                        // 通知代理服务器关闭此代理服务（关闭端口监听）
                        NettyMessage proxyMessage = new NettyMessage();
                        proxyMessage.setHeader(new Header().setType(MessageType.DISCONNECT));
                        proxyServerChannel.writeAndFlush(proxyMessage);
                        cmdChannel.writeAndFlush(proxyMessage);
                    }
                });
    }

    public void bind(Channel targetServerChannel, Channel cmdChannel, String userId) {
        // 建立隧道
        proxyServerBootstrap.connect(ProxyConfig.getServerHost(), ProxyConfig.getServerPort())
                .addListener(new ChannelFutureListener() {
                    @Override
                    public void operationComplete(ChannelFuture future) throws Exception {
                        // 连接成功
                        Channel proxyServerChannel = future.channel();
                        if (future.isSuccess()) {

                            ClientChannelManager.borrowProxyChanel(proxyServerBootstrap, new TunnelResultHandler() {
                                @Override
                                public void success(Channel ctx, NettyMessage msg) {
                                    // 绑定关系
                                    LOGGER.info("Connect proxy server success.");

                                    // 两个通道绑定关系
                                    proxyServerChannel.attr(AttrConstants.BIND_CHANNEL).set(targetServerChannel);
                                    targetServerChannel.attr(AttrConstants.BIND_CHANNEL).set(proxyServerChannel);

                                    // 通知代理服务器，隧道已经打通
                                    ProxyTunnelInfoResp resp = new ProxyTunnelInfoResp();
                                    resp.setUserId(userId);
                                    resp.setToken(ProxyConfig.client().getKey());
                                    NettyMessage proxyMessage = new NettyMessage();
                                    proxyMessage.setHeader(new Header().setType(MessageType.CONNECT_RESPONSE));
                                    proxyMessage.setBody(resp);
                                    proxyServerChannel.writeAndFlush(proxyMessage);

                                    // 重新注册和目标服务器通道的读事件
                                    targetServerChannel.config().setOption(ChannelOption.AUTO_READ, true);
                                    // 根据唯一标示缓存通道
                                    ClientChannelManager.addTargetServerChannel(userId, targetServerChannel);
                                    // 为通道绑定唯一标示
                                    ClientChannelManager.setTargetServerChannelUserId(targetServerChannel, userId);

                                }

                                @Override
                                public void error(Channel ctx, Throwable throwable) {
                                    NettyMessage proxyMessage = new NettyMessage();
                                    proxyMessage.setHeader(new Header().setType(MessageType.DISCONNECT));
                                    proxyMessage.setBody(userId);
                                    cmdChannel.writeAndFlush(proxyMessage);
                                }
                            });

                        } else {
                            LOGGER.warn("Connect proxy server failed.", future.cause());
                            // 通知代理服务器关闭此代理服务（关闭端口监听）
                            NettyMessage proxyMessage = new NettyMessage();
                            proxyMessage.setHeader(new Header().setType(MessageType.DISCONNECT));
                            proxyServerChannel.writeAndFlush(proxyMessage);
                            cmdChannel.writeAndFlush(proxyMessage);
                        }
                    }
                });
    }

Replace Anonymous With Lambda org.github.ponking66.core.TargetServerChannelFutureListener.bind.addListener.new ChannelFutureListener with future -> {Channel proxyServerChannel=future.channel(); in method public bind(targetServerChannel Channel, cmdChannel Channel, userId String) : void from class org.github.ponking66.core.TargetServerChannelFutureListener


    public static Map<String, Object> jsonToMap(String json) {
        return handleJsonOperation(() -> objectMapper.readValue(json, new TypeReference<>() {
        }));
    }

    public static Map<String, Object> jsonToMap(String json) {
        return handleJsonOperation(() -> objectMapper.readValue(json, new TypeReference<Map<String, Object>>() {
        }));
    }

Replace Generic With Diamond TypeReference<Map<String,Object>> with TypeReference<> in method public jsonToMap(json String) : Map<String,Object> from class in.dnsl.utils.JsonUtils


    public static Map<String, Object> objectToMap(Object obj) {
        return handleJsonOperation(() -> objectMapper.convertValue(obj, new TypeReference<>() {
        }));
    }

    public static Map<String, Object> objectToMap(Object obj) {
        return handleJsonOperation(() -> objectMapper.convertValue(obj, new TypeReference<Map<String, Object>>() {
        }));
    }

Replace Generic With Diamond TypeReference<Map<String,Object>> with TypeReference<> in method public objectToMap(obj Object) : Map<String,Object> from class in.dnsl.utils.JsonUtils


    public static void initialize() {
        dropChances = PluginMain.dropChances;
        Bukkit.getServer().getConsoleSender().sendMessage("[" + PluginMain.plugin.getName() + "] Starting internal scheduler...");
        Bukkit.getScheduler().scheduleSyncRepeatingTask(PluginMain.plugin, () -> {
            synchronized (messageTimestamp) {
                Iterator<Map.Entry<Player, Long>> iterator = messageTimestamp.entrySet().iterator();
                while (iterator.hasNext()) {
                    Map.Entry<Player, Long> entry = iterator.next();
                    Long timeStamp = entry.getValue();
                    if (System.currentTimeMillis() > timeStamp + 10000) {
                        iterator.remove();
                    }
                }
            }
        }, 20, 20 * ORE_MESSAGE_DELAY / 1000 - 1);
    }

    public static void initialize() {
        dropChances = PluginMain.dropChances;
        Bukkit.getServer().getConsoleSender().sendMessage("[" + PluginMain.plugin.getName() + "] Starting internal scheduler...");
        Bukkit.getScheduler().scheduleSyncRepeatingTask(PluginMain.plugin, new Runnable() {
            @Override
            public void run() {
                synchronized (messageTimestamp) {
                    Iterator iterator = messageTimestamp.entrySet().iterator();
                    while (iterator.hasNext()) {
                        Map.Entry entry = (Map.Entry) iterator.next();
                        Player player = (Player) entry.getKey();
                        Long timeStamp = (Long) entry.getValue();
                        if (System.currentTimeMillis() > timeStamp + 10000) {
                            iterator.remove();
                        }
                    }
                }
            }
        }, 20, 20 * ORE_MESSAGE_DELAY / 1000 - 1);
    }

Replace Anonymous With Lambda me.apisek12.StoneDrop.EventListeners.BlockListener.initialize.scheduleSyncRepeatingTask.new Runnable with () -> {synchronized(messageTimestamp){Iterator<Map.Entry<Player,Long>> iterator=messageTimestamp.entrySet().iterator(); in method public initialize() : void from class me.apisek12.StoneDrop.EventListeners.BlockListener


    @EventHandler
    public void PlayerRespawnEvent(PlayerRespawnEvent e) {

        Bukkit.getScheduler().scheduleSyncDelayedTask(PluginMain.plugin, () -> {
            Player player = e.getPlayer();
            player.setGameMode(GameMode.SURVIVAL);
        }, 200);

    }

    @EventHandler
    public void PlayerRespawnEvent(PlayerRespawnEvent e) {

        Bukkit.getScheduler().scheduleSyncDelayedTask(PluginMain.plugin, new Runnable() {
            @Override
            public void run() {
                Player player = e.getPlayer();
                player.setGameMode(GameMode.SURVIVAL);
            }
        }, 200);

    }

Replace Anonymous With Lambda me.apisek12.plugin.MyEvents.PlayerRespawnEvent.scheduleSyncDelayedTask.new Runnable with () -> {Player player=e.getPlayer(); in method public PlayerRespawnEvent(e PlayerRespawnEvent) : void from class me.apisek12.plugin.MyEvents


    @EventHandler
    public void blockBreak(BlockBreakEvent event) {

        if (!PluginMain.isIsDisabled()){
        Block block = event.getBlock();
        Location location = block.getLocation();
        World world = block.getWorld();
        Material tool = event.getPlayer().getInventory().getItemInMainHand().getType();

        if (block.getBlockData().getMaterial() == Material.STONE && event.getPlayer().getGameMode().equals(GameMode.SURVIVAL) &&  (tool == Material.DIAMOND_PICKAXE ||
        tool == Material.GOLDEN_PICKAXE || tool == Material.IRON_PICKAXE || tool == Material.STONE_PICKAXE || tool == Material.WOODEN_PICKAXE)) {
            if (PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get("COBBLE").isOn()) event.setDropItems(false);

            if (Chance.chance(PluginMain.chestSpawnRate)){
                Bukkit.getScheduler().runTaskLater(PluginMain.plugin, () -> {
                    block.setType(Material.CHEST);
//                        Location fireworkToSpawn = event.getBlock().getLocation();
//                        fireworkToSpawn.setY(fireworkToSpawn.getBlock().getLocation().getY()+20);
//                        Firework firework = (Firework) block.getLocation().getWorld().spawnEntity(fireworkToSpawn, EntityType.FIREWORK);
//                        FireworkMeta fireworkMeta = firework.getFireworkMeta();
//                        fireworkMeta.setPower(10);
//                        fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.LIME).with(FireworkEffect.Type.BALL_LARGE).flicker(true).withColor(Color.RED).withFade(Color.BLUE).build());
//                        firework.setFireworkMeta(fireworkMeta);
//                        firework.detonate();
                    event.getPlayer().sendTitle(ChatColor.GOLD+"Znalazłeś "+ ChatColor.GREEN+ "skrzynię "+ ChatColor.GOLD+"skarbów!", ChatColor.AQUA+"Ciekawe co jest w środku...", 20, 20, 15);
                    event.getPlayer().playSound(event.getBlock().getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, 0.7f, 1f);
                    Chest chest = (Chest) block.getState();
                    Bukkit.getScheduler().runTaskLater(PluginMain.plugin, new Runnable() {
                        @Override
                        public void run() {
                            chest.getBlockInventory().clear();
                            block.setType(Material.AIR);
                            Firework firework = (Firework) block.getLocation().getWorld().spawnEntity(block.getLocation(), EntityType.FIREWORK);
                            FireworkMeta fireworkMeta = firework.getFireworkMeta();
                            fireworkMeta.setPower(3);
                            fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.RED).flicker(true).withColor(Color.GRAY).withFade(Color.AQUA).build());
                            firework.setFireworkMeta(fireworkMeta);
                            firework.detonate();
                        }
                    }, 200);
                    for (Material material : PluginMain.chestContent.keySet()){
                        if (Chance.chance(PluginMain.chestContent.get(material).getChance())){
                            if (PluginMain.chestContent.get(material).getEnchantment() != null){
                                ItemStack item = new ItemStack(material, Chance.randBetween(PluginMain.chestContent.get(material).getMin(), PluginMain.chestContent.get(material).getMax()));
                                ItemMeta meta = item.getItemMeta();
                                PluginMain.chestContent.get(material).getEnchantment().forEach((whatToEnchant, level)->{
                                    meta.addEnchant(whatToEnchant, level, true);
                                });
                                item.setItemMeta(meta);
                                chest.getBlockInventory().setItem(getRandomFreeSlot(chest.getBlockInventory()), item);
                            }

                            else chest.getBlockInventory().addItem(new ItemStack(material, Chance.randBetween(PluginMain.chestContent.get(material).getMin(), PluginMain.chestContent.get(material).getMax())));
                        }
                    }
                }, 4);

            }

            if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 1) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")){
                        if (Chance.chance(dropChances.get(set[i]).getF1()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf1(), dropChances.get(set[i]).getMaxf1()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                        else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf1(), dropChances.get(set[i]).getMaxf1())));

                            }
                    }
                }

                event.getPlayer().giveExp(15);
            }
            else if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 2) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getF2()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf2(), dropChances.get(set[i]).getMaxf2()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf2(), dropChances.get(set[i]).getMaxf2())));

                            }
                    }
                    }

                event.getPlayer().giveExp(18);
            }
            else if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 3) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getF3()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
//                            world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3())));
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3())));

                            }
                    }
                    }

                event.getPlayer().giveExp(20);
            }
            else  {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getNof()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
//                            world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof())));
                            if (dropChances.get(set[i]).getEnchant().size() != 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof())));

                            }
                    }event.getPlayer().giveExp(12);
                }

        }
    }}}

    @EventHandler
    public void blockBreak(BlockBreakEvent event) {

        if (!PluginMain.isIsDisabled()){
        Block block = event.getBlock();
        Location location = block.getLocation();
        World world = block.getWorld();
        Material tool = event.getPlayer().getInventory().getItemInMainHand().getType();

        if (block.getBlockData().getMaterial() == Material.STONE && event.getPlayer().getGameMode().equals(GameMode.SURVIVAL) &&  (tool == Material.DIAMOND_PICKAXE ||
        tool == Material.GOLDEN_PICKAXE || tool == Material.IRON_PICKAXE || tool == Material.STONE_PICKAXE || tool == Material.WOODEN_PICKAXE)) {
            if (PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get("COBBLE").isOn()) event.setDropItems(false);

            if (Chance.chance(PluginMain.chestSpawnRate)){
                Bukkit.getScheduler().runTaskLater(PluginMain.plugin, new Runnable() {
                    @Override
                    public void run() {
                        block.setType(Material.CHEST);
//                        Location fireworkToSpawn = event.getBlock().getLocation();
//                        fireworkToSpawn.setY(fireworkToSpawn.getBlock().getLocation().getY()+20);
//                        Firework firework = (Firework) block.getLocation().getWorld().spawnEntity(fireworkToSpawn, EntityType.FIREWORK);
//                        FireworkMeta fireworkMeta = firework.getFireworkMeta();
//                        fireworkMeta.setPower(10);
//                        fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.LIME).with(FireworkEffect.Type.BALL_LARGE).flicker(true).withColor(Color.RED).withFade(Color.BLUE).build());
//                        firework.setFireworkMeta(fireworkMeta);
//                        firework.detonate();
                        event.getPlayer().sendTitle(ChatColor.GOLD+"Znalazłeś "+ ChatColor.GREEN+ "skrzynię "+ ChatColor.GOLD+"skarbów!", ChatColor.AQUA+"Ciekawe co jest w środku...", 20, 20, 15);
                        event.getPlayer().playSound(event.getBlock().getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, 0.7f, 1f);
                        Chest chest = (Chest) block.getState();
                        Bukkit.getScheduler().runTaskLater(PluginMain.plugin, new Runnable() {
                            @Override
                            public void run() {
                                chest.getBlockInventory().clear();
                                block.setType(Material.AIR);
                                Firework firework = (Firework) block.getLocation().getWorld().spawnEntity(block.getLocation(), EntityType.FIREWORK);
                                FireworkMeta fireworkMeta = firework.getFireworkMeta();
                                fireworkMeta.setPower(3);
                                fireworkMeta.addEffect(FireworkEffect.builder().withColor(Color.RED).flicker(true).withColor(Color.GRAY).withFade(Color.AQUA).build());
                                firework.setFireworkMeta(fireworkMeta);
                                firework.detonate();
                            }
                        }, 200);
                        for (Material material : PluginMain.chestContent.keySet()){
                            if (Chance.chance(PluginMain.chestContent.get(material).getChance())){
                                if (PluginMain.chestContent.get(material).getEnchantment() != null){
                                    ItemStack item = new ItemStack(material, Chance.randBetween(PluginMain.chestContent.get(material).getMin(), PluginMain.chestContent.get(material).getMax()));
                                    ItemMeta meta = item.getItemMeta();
                                    PluginMain.chestContent.get(material).getEnchantment().forEach((whatToEnchant, level)->{
                                        meta.addEnchant(whatToEnchant, level, true);
                                    });
                                    item.setItemMeta(meta);
                                    chest.getBlockInventory().setItem(getRandomFreeSlot(chest.getBlockInventory()), item);
                                }

                                else chest.getBlockInventory().addItem(new ItemStack(material, Chance.randBetween(PluginMain.chestContent.get(material).getMin(), PluginMain.chestContent.get(material).getMax())));
                            }
                        }
                    }
                }, 4);

            }

            if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 1) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")){
                        if (Chance.chance(dropChances.get(set[i]).getF1()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf1(), dropChances.get(set[i]).getMaxf1()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                        else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf1(), dropChances.get(set[i]).getMaxf1())));

                            }
                    }
                }

                event.getPlayer().giveExp(15);
            }
            else if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 2) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getF2()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf2(), dropChances.get(set[i]).getMaxf2()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf2(), dropChances.get(set[i]).getMaxf2())));

                            }
                    }
                    }

                event.getPlayer().giveExp(18);
            }
            else if (event.getPlayer().getInventory().getItemInMainHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) == 3) {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getF3()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
//                            world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3())));
                            if (dropChances.get(set[i]).getEnchant().size() > 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinf3(), dropChances.get(set[i]).getMaxf3())));

                            }
                    }
                    }

                event.getPlayer().giveExp(20);
            }
            else  {
                for (int i = 0; i < set.length; i++){
                    if (!set[i].equals("COBBLE") && !set[i].equals("STACK")) {
                        if (Chance.chance(dropChances.get(set[i]).getNof()) && PluginMain.playerSettings.get(event.getPlayer().getUniqueId().toString()).get(set[i]).isOn())
//                            world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof())));
                            if (dropChances.get(set[i]).getEnchant().size() != 0){
                                ItemStack itemToDrop = new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof()));
                                ItemMeta itemMeta = itemToDrop.getItemMeta();
                                dropChances.get(set[i]).getEnchant().forEach(((enchantment, level) -> {
                                    itemMeta.addEnchant(enchantment, level, false);
                                }));
                                itemToDrop.setItemMeta(itemMeta);
                                world.dropItem(location, itemToDrop);

                            }
                            else {
                                world.dropItem(location, new ItemStack(Material.getMaterial(set[i]), Chance.randBetween(dropChances.get(set[i]).getMinnof(), dropChances.get(set[i]).getMaxnof())));

                            }
                    }event.getPlayer().giveExp(12);
                }

        }
    }}}

Replace Anonymous With Lambda me.apisek12.plugin.MyEvents.blockBreak.runTaskLater.new Runnable with () -> {block.setType(Material.CHEST); in method public blockBreak(event BlockBreakEvent) : void from class me.apisek12.plugin.MyEvents