I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE COURSE

The method contains() checks if a String contains another String. The method accepts a CharSequence. So, we can pass any of the implementing classes to it such as StringBuilder and StringBuffer.

Available Signatures

public boolean contains(CharSequence s)

Example

@Test
public void whenCallContains_thenCorrect() {
    String s = "abcd";
    
    assertTrue(s.contains("abc"));
    assertFalse(s.contains("cde"));
}

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE LESSONS