Skip to content

Commit

Permalink
Refactor HeaderField and HeaderName constructors for efficiency
Browse files Browse the repository at this point in the history
Remove unnecessary object creation in HeaderField copy constructor. Simplify HeaderName by removing redundant copy constructor.
  • Loading branch information
christiangoerdes committed Sep 6, 2024
1 parent bf548c1 commit 00446a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ public HeaderField(String headerName,String value) {
}

public HeaderField(HeaderField element) {
headerName = new HeaderName(element.headerName);
headerName = element.headerName;
value = element.value;
}

public String getValue() {
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ public HeaderName(String name) {
this.name = name;
}

public HeaderName(HeaderName hn) {
this.name = hn.name;
}

@Override
public boolean equals(Object obj) {
return (this == obj) || (obj instanceof HeaderName hn) && (name.equalsIgnoreCase((hn.name)));
Expand Down

0 comments on commit 00446a5

Please sign in to comment.