Created
July 18, 2013 10:52
-
-
Save trepidacious/6028412 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 class ListBuilder { | |
| private final StringBuilder b = new StringBuilder(); | |
| public ListBuilder li(String s) { | |
| if (s!=null && !s.trim().isEmpty()) { | |
| b.append("<li>"); b.append(s); b.append(</li>); | |
| } | |
| return this; | |
| } | |
| public String toString() { | |
| return b.toString(); | |
| } | |
| public static void main(String[] args) { | |
| String s = new ListBuilder() | |
| .li(rMap.get("a") | |
| .li(rMap.get("b") | |
| .li(rMap.get("c") | |
| .toString(); | |
| System.out.println(s); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment