Skip to main content
Code Review

Return to Answer

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

@Marc-Andre @Marc-Andre and @janos @janos answers are very informative, consider mine to be an expansion to theirs... :)

@Marc-Andre and @janos answers are very informative, consider mine to be an expansion to theirs... :)

@Marc-Andre and @janos answers are very informative, consider mine to be an expansion to theirs... :)

added 4 characters in body; deleted 155 characters in body
Source Link
h.j.k.
  • 19.4k
  • 3
  • 37
  • 93
  • You don't need a new String() below:

     String relativePath = new String(String.format("/api/%s/%s", apiKey, feature));
    
  • Inline more, inline often

    I feel there are some places where you can neatly inline methods, reducing the number of variable assignments. For example, I may choose to write createUrl() in the following way:

     public URL createUrl(String feature) throws MalformedURLException {
     return new URL(PROTOCOL, WU_HOST, String.format("/api/%s/%s", apiKey, feature));
     // or consider Java 8's String.join() method
     // return new URL(PROTOCOL, WU_HOST, String.join("/", "api", apiKey, feature));
     }
    
  • You don't need a new String() below:

     String relativePath = new String(String.format("/api/%s/%s", apiKey, feature));
    
  • Inline more, inline often

    I feel there are some places where you can neatly inline methods, reducing the number of variable assignments. For example, I may choose to write createUrl() in the following way:

     public URL createUrl(String feature) throws MalformedURLException {
     return new URL(PROTOCOL, WU_HOST, String.format("/api/%s/%s", apiKey, feature));
     // or consider Java 8's String.join() method
     // return new URL(PROTOCOL, WU_HOST, String.join("/", "api", apiKey, feature));
     }
    
  • You don't need a new String() below:

     String relativePath = new String(String.format("/api/%s/%s", apiKey, feature));
    
  • Inline more, inline often

    I feel there are some places where you can neatly inline methods, reducing the number of variable assignments. For example, I may choose to write createUrl() in the following way:

     public URL createUrl(String feature) throws MalformedURLException {
     return new URL(PROTOCOL, WU_HOST, String.format("/api/%s/%s", apiKey, feature));
     }
    
added 2 characters in body
Source Link
h.j.k.
  • 19.4k
  • 3
  • 37
  • 93

JsonReaderJsonReader

JsonReader

JsonReader

added 1 character in body
Source Link
h.j.k.
  • 19.4k
  • 3
  • 37
  • 93
Loading
Source Link
h.j.k.
  • 19.4k
  • 3
  • 37
  • 93
Loading
lang-java

AltStyle によって変換されたページ (->オリジナル) /