package com.ian;

import java.util.stream.Stream;

public class RedirectLister {
    private static String[] redirectFrom = { "/redirect" };
    private static String[] redirectTo = { "/" };

    public static boolean checkRedirect(String url) {
        return Stream.of(redirectFrom).anyMatch(x -> x.equals(url));
    }

    public static String getRedirectionUrl(String url) {
        String redirection = url;
        for (int i = 0; i < redirectFrom.length; i++) {
            if (redirectFrom[i].equals(url)) { redirection = redirectTo[i]; }
        }
        return redirection;
    }
}

@@ -32,21 +32,15 @@
 til.
-stream.Stream
+HashMap
 ;%0A%0Ap
@@ -91,98 +91,145 @@
 tic 
-String%5B%5D redirectFrom = %7B %22/redirect%22 %7D;%0A    private static String%5B%5D redirectTo = %7B %22/%22
+HashMap%3CString, String%3E redirectMap;%0A    static %7B%0A        redirectMap = new HashMap%3C%3E();%0A        redirectMap.put(%22/redirect%22, %22/%22);%0A   
  %7D
-;
 %0A%0A  
@@ -292,219 +292,240 @@
     
-return Stream.of(redirectFrom).anyMatch(x -%3E x.equals(url));%0A    %7D%0A%0A    public static String getRedirectionUrl(String url) %7B%0A        String redirection = url;%0A        for (int i = 0; i %3C redirectFrom.length; i++
+for (String key: redirectMap.keySet()) %7B%0A            if (key.equals(url)) %7B return true; %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    public static String getRedirectionUrl(String url) %7B%0A        for (String key: redirectMap.keySet()
 ) %7B%0A
@@ -544,23 +544,11 @@
 if (
-redirectFrom%5Bi%5D
+key
 .equ
@@ -565,33 +565,33 @@
 %7B re
-direction = redirectTo%5Bi%5D
+turn redirectMap.get(key)
 ; %7D%0A
@@ -619,19 +619,11 @@
 urn 
-redirection
+url
 ;%0A  

refactor RedirectLister from 2 arrays to hashmap