import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

class ProteinTranslator {
    private static final Integer CODON_LENGTH = 3;
    // Codon                 | Protein
    // :---                  | :---
    // AUG                   | Methionine
    // UUU, UUC              | Phenylalanine
    // UUA, UUG              | Leucine
    // UCU, UCC, UCA, UCG    | Serine
    // UAU, UAC              | Tyrosine
    // UGU, UGC              | Cysteine
    // UGG                   | Tryptophan
    // UAA, UAG, UGA         | STOP
    private static final Map<String, String> CODON_TO_PROTEIN = Map.ofEntries(
        Map.entry("AUG", "Methionine"),
        Map.entry("UUU", "Phenylalanine"),
        Map.entry("UUC", "Phenylalanine"),
        Map.entry("UUA", "Leucine"),
        Map.entry("UUG", "Leucine"),
        Map.entry("UCU", "Serine"),
        Map.entry("UCC", "Serine"),
        Map.entry("UCA", "Serine"),
        Map.entry("UCG", "Serine"),
        Map.entry("UAU", "Tyrosine"),
        Map.entry("UAC", "Tyrosine"),
        Map.entry("UGU", "Cysteine"),
        Map.entry("UGC", "Cysteine"),
        Map.entry("UGG", "Tryptophan")
    );
    private static final Set<String> STOP_CODONS = Set.of("UAA", "UAG", "UGA");

    List<String> translate(final String rnaSequence) {
        final List<String> codons = splitIntoCodons(rnaSequence);
        List<String> proteins = new ArrayList<>();
        for(String codon: codons) {
            if(STOP_CODONS.contains(codon)) {
                return proteins;
            }
            proteins.add(translateCodon(codon));
        };
        return proteins;
    }

    List<String> splitIntoCodons(final String rnaSequence) {
        final List<String> codons = new ArrayList<>();
        for(int i = 0; i < rnaSequence.length(); i += CODON_LENGTH) {
            codons.add(rnaSequence.substring(i, Math.min(rnaSequence.length(), i + CODON_LENGTH)));
        }
        return codons;
    }

    String translateCodon(final String codon) {
        return CODON_TO_PROTEIN.get(codon);
    }
}

@@ -170,405 +170,8 @@
  3;%0A
-    // Codon                 %7C Protein%0A    // :---                  %7C :---%0A    // AUG                   %7C Methionine%0A    // UUU, UUC              %7C Phenylalanine%0A    // UUA, UUG              %7C Leucine%0A    // UCU, UCC, UCA, UCG    %7C Serine%0A    // UAU, UAC              %7C Tyrosine%0A    // UGU, UGC              %7C Cysteine%0A    // UGG                   %7C Tryptophan%0A    // UAA, UAG, UGA         %7C STOP%0A
     

Remove comment describing codon -> protein