Rotating a String Using Lambda

So I encountered this question today, but since we are given the answer I tried rotating it using lambda, I doubt my approach which was using the reverse string using lambda to rotate it but would appreciate feedback on how I can approach this. code below

We are given two strings, A and B.

A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = ‘abcde’, then it will be ‘bcdea’ after one shift on A. Return True if and only if A can become B after some number of shifts on A.

Example 1:
Input: A = ‘abcde’, B = ‘cdeab’
Output: true

Example 2:
Input: A = ‘abcde’, B = ‘abced’
Output: false

My Interface:

public interface MyString {
    String myStringFunction(String str, String str1);


public class RotateString {

    public static String onRotateString(MyString rotateString, String A, String B) {
        return rotateString.myStringFunction(A, B);

    public static void main(String[] args) {
        MyString rotate = (A, B) -> {
            String results = "";
            for (int i = 0; i < A.length(); ++i)
                for (int j = 0; j < B.length(); ++j)
                    if (A.charAt((i + j) % A.length()) != B.charAt(i))
                        results += A.charAt((i + j) % A.length());
            return results;

        System.out.println(onRotateString(rotate, "abcde", "abcde"));

just practicing.
OutPut: truetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetruetrue