Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit d035c4d

Browse files
authored
Changed HashMap to Map
Changed HashMap to Map
2 parents 652e394 + fcbdcf5 commit d035c4d

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchange.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.kttdevelopment.simplehttpserver;
22

3-
import com.sun.net.httpserver.*;
43
import com.kttdevelopment.simplehttpserver.var.HttpCode;
54
import com.kttdevelopment.simplehttpserver.var.RequestMethod;
5+
import com.sun.net.httpserver.*;
66

77
import java.io.IOException;
88
import java.io.OutputStream;
99
import java.net.InetSocketAddress;
1010
import java.net.URI;
11-
import java.util.HashMap;
11+
import java.util.Map;
1212

1313
/**
1414
* <i>This class is a simplified implementation of {@link HttpExchange}</i>. <br>
@@ -46,7 +46,7 @@
4646
*
4747
* @see HttpExchange
4848
* @since 02.00.00
49-
* @version 03.04.00
49+
* @version 03.04.03
5050
* @author Ktt Development
5151
*/
5252
@SuppressWarnings("SpellCheckingInspection")
@@ -221,7 +221,7 @@ static SimpleHttpExchange create(final HttpExchange exchange){
221221
* @since 02.00.00
222222
* @author Ktt Development
223223
*/
224-
public abstract HashMap<String,String> getGetMap();
224+
public abstract Map<String,String> getGetMap();
225225

226226
/**
227227
* Returns if there is a GET request.
@@ -261,7 +261,7 @@ static SimpleHttpExchange create(final HttpExchange exchange){
261261
* @author Ktt Development
262262
*/
263263
@SuppressWarnings("rawtypes")
264-
public abstract HashMap getPostMap();
264+
public abstract Map getPostMap();
265265

266266
/**
267267
* Returns if there is a POST request.
@@ -313,7 +313,7 @@ static SimpleHttpExchange create(final HttpExchange exchange){
313313
* @since 02.00.00
314314
* @author Ktt Development
315315
*/
316-
public abstract HashMap<String,String> getCookies();
316+
public abstract Map<String,String> getCookies();
317317

318318
/**
319319
* Sets a cookie in the response header.

src/main/java/com/kttdevelopment/simplehttpserver/SimpleHttpExchangeImpl.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @see SimpleHttpExchange
1919
* @since 02.00.00
20-
* @version 03.04.00
20+
* @version 03.04.03
2121
* @author Ktt Development
2222
*/
2323
@SuppressWarnings("SpellCheckingInspection")
@@ -37,20 +37,20 @@ final class SimpleHttpExchangeImpl extends SimpleHttpExchange {
3737
private final RequestMethod requestMethod;
3838

3939
private final String rawGet;
40-
private final HashMap<String,String> getMap;
40+
private final Map<String,String> getMap;
4141
private final boolean hasGet;
4242

4343
private final String rawPost;
4444
@SuppressWarnings("rawtypes")
45-
private final HashMap postMap;
45+
private final Map postMap;
4646
private final boolean hasPost;
4747

48-
private final HashMap<String,String> cookies;
48+
private final Map<String,String> cookies;
4949

5050
private final OutputStream outputStream;
5151

5252
@SuppressWarnings("FieldCanBeLocal")
53-
private final Function<String,HashMap<String,String>> parseWwwFormEnc = s -> {
53+
private final Function<String,Map<String,String>> parseWwwFormEnc = s -> {
5454
final LinkedHashMap<String,String> OUT = new LinkedHashMap<>();
5555
final String[] pairs = s.split("&");
5656

@@ -144,13 +144,13 @@ static SimpleHttpExchange create(final HttpExchange exchange){
144144
postMap = new HashMap<>();
145145
final String[] pairs = OUT.replace(endBoundary,"").split(Pattern.quote(startBoundary));
146146
for(String pair : pairs){
147-
final HashMap<String, HashMap> postHeaders = new HashMap<>();
147+
final Map<String, Map> postHeaders = new HashMap<>();
148148
if(pair.contains("\r\n\r\n")){
149149
final String[] headers = pair.substring(0, pair.indexOf("\r\n\r\n")).split("\r\n");
150150

151151
for (String header : headers) {
152-
final HashMap headerMap = new HashMap<>();
153-
final HashMap<String, String> val = new HashMap<>();
152+
final Map headerMap = new HashMap<>();
153+
final Map<String, String> val = new HashMap<>();
154154

155155
final Matcher headerMatcher = boundaryHeaderPattern.matcher(header);
156156
if (headerMatcher.find()) {
@@ -165,7 +165,7 @@ static SimpleHttpExchange create(final HttpExchange exchange){
165165
postHeaders.put((String) headerMap.get("header-name"), headerMap);
166166
}
167167

168-
final HashMap row = new HashMap();
168+
final Map row = new HashMap();
169169
row.put("headers",postHeaders);
170170
row.put("value",pair.substring(pair.indexOf("\r\n\r\n")+4,pair.lastIndexOf("\r\n")));
171171

@@ -259,7 +259,7 @@ public final String getRawGet(){
259259
}
260260

261261
@Override
262-
public final HashMap<String, String> getGetMap(){
262+
public final Map<String, String> getGetMap(){
263263
return getMap;
264264
}
265265

@@ -276,7 +276,7 @@ public final String getRawPost(){
276276
}
277277

278278
@Override @SuppressWarnings("rawtypes")
279-
public final HashMap getPostMap(){
279+
public final Map getPostMap(){
280280
return postMap;
281281
}
282282

@@ -301,7 +301,7 @@ public final int getResponseCode(){
301301

302302

303303
@Override
304-
public final HashMap<String, String> getCookies(){
304+
public final Map<String, String> getCookies(){
305305
return new HashMap<>(cookies);
306306
}
307307

0 commit comments

Comments
 (0)