Author: Mingch

Mingch is a software engineer who helps startups on software development. My expertise offer in mobile development, web development projects, as well as private consultations.

Java, DateTimeFormatter

To format Java 8 LocalDate, LocalTime or LocalDateTime. We can use DateTimeFormatter. Month Output Day Output Year Output Day Of Month Quarter of Year AM/PM LocalizedDate, LocalizedTime & LocalizeDateTime – FormatStyle.SHORT LocalizedDate, LocalizedTime & LocalizeDateTime – FormatStyle.MEDIUM LocalizedDate, LocalizedTime &

Java Array, ArrayList Conversion

Convert List to Array List<String> list = new ArrayList<>();list.add(“man”);list.add(“women”);String[] arr = list.toArray(new String[list.size()]);System.out.println(Arrays.toString(arr)); Convert Array to List String[] arr = {“car”,”bike”,”van”};List<String> list = Arrays.asList(arr); // return fixed size listSystem.out.println(Arrays.toString(arr));System.out.println(list);System.out.println(list.size()); // 3System.out.println(arr.length); // 3 Replace element list.set(0, “lori”); System.out.println(Arrays.toString(arr)); System.out.println(list); Add