Merging java.util.Properties Objects 1. Introduction In this short tutorial, we’ll focus on how to merge two or more Java Properties objects into one. We’ll explore three solutions, firstly starting with an example using iteration. Next, we’ll look into using the putAll() method and to conclude the tutorial, we’ll look at… Continue Reading java-merging-properties

Java String.charAt() Java The method charAt() returns the character at the specified index. The index value must be between 0 and String.length() – 1. Available Signatures public char charAt(int index) Example @Test public void whenCallCharAt_thenCorrect() { assertEquals(‘P’, “Paul”.charAt(0)); } Throws IndexOutOfBoundsException – if a non-existent or a negative index is… Continue Reading string-char-at

Java String.codePointCount() Java Java String The method codePointCount() returns the number of Unicode code points in the specified range. The text range begins at the first index and ends at the second index – 1. Available Signatures public int codePointCount(int beginIndex, int endIndex) Example @Test public void whenCallCodePointCount_thenCorrect() { assertEquals(2,… Continue Reading string-code-point-count

Java String.concat() Java Java String The method concat() concatenates two Strings. Simply put, it connects them into a single String. If the length of the argument is 0, then the method simply returns the String object. Available Signatures public String concat(String str) Example @Test public void whenCallConcat_thenCorrect() { assertEquals(“elephant”, “elep”.concat(“hant”));… Continue Reading string-concat

Java String.isEmpty() Java Java String The method isEmpty() is a convenience method that checks if the size of a String is equal to zero. Available Signatures public boolean isEmpty() Example @Test public void whenCallIsEmpty_thenCorrect() { String s1 = “”; assertTrue(s1.isEmpty()); } Next » Java String.lastIndexOf() « Previous Java String.intern()