Introduction In this tutorial, we will learn how to add @author comments to every new class that we create. We can achieve it using either of the following two solutions Solution 1: Automatically add @author comments to every new class using Files and Code Templates Open File -> Settings -> Editor -> File and Code Templates -> Includes Click on Includes . Under File Header , enter the following comments text /** * @author ${USER} * @Date ${DATE} */ Intellij - add @author comments Solution 2: Autocompletion of @author Open File -> Settings -> Editor -> Live Templates Select Java and then click on + button In Abbreviation, enter @a In template text , enter the following comments /** * @author ${USER} * @Date ${DATE} */ In option , Expands with select SPACE Intellij - Autocompletion @author You can simply add the @author comments by typing @a and then click SPACE
When I try to launch the tomcat from Eclipse, I encountered the following error Server Tomcat v8.5 Server at localhost failed to start. Solution Step 1 Delete the .snap file located at the following location eclipse workspace Path\ .metadata\.plugins\org.eclipse.core.resources Step 2 Delete the tmp0 folder from the following path eclipse workspace Path \.metadata\.plugins\org.eclipse.wst.server.core Step 3 Delete the server from servers list Step 4 Remove already added Tomcat Server i) Click on Define a new Server ii) Select Server Runtime Environments iii) Select the Tomcat Server and remove it as follows Remove Selected Server Step 5 Make sure that correct version of Server is configured in Project Properties Step 6 Restart the Eclipse IDE.
Problem How to convert Enum to List of String in Java 8? Solution Using the Java 8 Streams, its map and collect functions we can convert Enum to List of Strings Code import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; public class EnumToStringList { public enum Alpha { A,B,C,D; } public static void main(String[] args) { List<String> strings = Stream.of(Alpha.values()).map( Alpha::name).collect( Collectors.toList()); } }
Comments
Post a Comment