Is that a question about what the algorithm is to solve the problem?
Or do you have the algorithm for the solving the problem and are asking how to code it in java?
If the latter, post it with your questions about how the problems you are having writing the code.
Let me start again from the beginning (at first I tried to simplify the problem but now I realize that the way that I put it changes everything).
First of all, I have to write a code in Java that prints all the combinations of the string 'WXYZ' in lexicographic order (I removed the 'W' to make the problem simpler but now I realize that I should not have).
Why would you want indexOf()? What about contains()? But that doesn't answer my first question. “Trying out” a method looks like guessing, and it looks as though you hadn't yet worked out what(←read that link) you want to do. You cannot write code until you have worked out what you are doing, and then you write the algorithm on paper. Once you have the correct algorithm, the coding will become easy.
Suppose that your 'lexicographic' method has a parameter 'List<Character> doNotPrint', then it is efficient to take this into account in the 'for' loop, like
it is not very userfriendly to bother the user with a method that requires a sorted char and an output string. A possibility is to make this method private, rename it as say 'lexicographicHelper'. Have a user method 'lexicograpic(String string, List<Character> doNotPrint)', that calls the Helper method.
There are three kinds of actuaries: those who can count, and those who can't.