Created
April 16, 2015 16:39
-
-
Save pumpkincouture/d3554024389d58632ce2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public HashMap<String, String> getHeaders() { | |
| return createTable(getMatchingStrings(); | |
| } | |
| private List<String> getMatchingStrings() { | |
| List<String> headersStrings = new ArrayList<>(); | |
| for (String string : splitRequest) { | |
| if (string.contains(": ")) { | |
| headersStrings.add(string); | |
| } | |
| } | |
| return headersStrings; | |
| } | |
| private HashMap<String, String> createTable(List<String> headerStrings) { | |
| HashMap<String, String> headers = new LinkedHashMap<>(); | |
| for (String string : headerStrings) { | |
| String[] splitHeaders = string.split(":\\s"); | |
| headers.put(splitHeaders[0], splitHeaders[1]); | |
| } | |
| return headers; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment