Wednesday, 28 August 2019

how to create and init a array with element in one line in java


depends on which version of java you are using, you have different solutions:


https://stackoverflow.com/questions/20358883/how-to-quickly-and-conveniently-create-a-one-element-arraylist

https://www.baeldung.com/java-init-list-one-line



array in annotation. e.g.




@DataMongoTest(includeFilters = @ComponentScan.Filter({ Service.class, Component.class, Configuration.class }))



here Filters is an array,  you just need to {a, b, c}


No comments:

Post a comment