bendingthejavaspoon.com
Bending the Java spoon: March 2010
http://www.bendingthejavaspoon.com/2010_03_01_archive.html
Bending the Java spoon. Op4j news and example recipes. Adding an element to an array at a specific position. Valid since: op4j 1.0. Insert a new element into an array at a specific position. Variable, of type. Minerals = ARRAY [ "Talc", "Quartz", "Diamond" ]. And we want to add "Fluorite". At the second position of the array, as it is harder than talc but softer than quartz:. Minerals = ARRAY [ "Talc", "Fluorite", "Quartz", "Diamond" ]. Minerals = Op.on(minerals).insert(1 ,"Fluorite").get();. If we wante...
bendingthejavaspoon.com
Bending the Java spoon: Create a map from a List with the valid and invalid percentages
http://www.bendingthejavaspoon.com/2010/12/create-map-from-list-with-valid-and.html
Bending the Java spoon. Op4j news and example recipes. Create a map from a List. With the valid and invalid percentages. Valid since: op4j 1.1. Create a map with two keys: "VALID" with the strings valid as a percentage between 0 and 100 and "INVALID" with the not valid ones. List variable contains some strings that, in some cases, represent valid percentages:. List String list = new ArrayList String ();. Map String, List String result = new LinkedHashMap String, List String ();. Let's see it coded with o...
bendingthejavaspoon.com
Bending the Java spoon: May 2010
http://www.bendingthejavaspoon.com/2010_05_01_archive.html
Bending the Java spoon. Op4j news and example recipes. Converting the keys in a map. Valid since: op4j 1.0. Convert all the keys in a map without changing its corresponding values. Map String,String map. Variable contains some numbers (as keys) along with their names in English language (as values):. Map = MAP [ {"1", "one"}, {"2", "two"}, {"3", "three"} ]. But notice that keys are Strings, not real. Objects, and that is precisely what we want to obtain, a. Map Integer,String newMap. Boolean result = Op&...
bendingthejavaspoon.com
Bending the Java spoon: Subtract a list of numbers from another one
http://www.bendingthejavaspoon.com/2011/07/subtract-list-of-numbers-from-another.html
Bending the Java spoon. Op4j news and example recipes. Subtract a list of numbers from another one. Valid since: op4j 1.1. Given two lists: one of ordered books and another of sent ones, subtract the sent books from the ordered ones and obtain the not yet sent. Notice that, if more books than ordered have been sent, the subtraction will be negative and you have to set those ones to 0 (we are not worried about the books we get for free). List variable contains the ordered books:. SentBooks.add(Integer...
bendingthejavaspoon.com
Bending the Java spoon: Modifying some elements in a list (depending on a specific condition)
http://www.bendingthejavaspoon.com/2010/05/modifying-some-elements-in-list.html
Bending the Java spoon. Op4j news and example recipes. Modifying some elements in a list (depending on a specific condition). Valid since: op4j 1.0. Given a list (or array, or set) with several elements, modify some of them by executing a function. The elements to be modified will be determined based on a condition. Variable contains some of the spices offered at our online shop, which are stored somewhere in our databases:. Herbs = LIST [ "*parsley*", "BASIL", "*Coriander*", "Spearmint" ]. Executes an O...
bendingthejavaspoon.com
Bending the Java spoon: December 2010
http://www.bendingthejavaspoon.com/2010_12_01_archive.html
Bending the Java spoon. Op4j news and example recipes. Convert a List String to a List DateMidnight. Valid since: op4j 1.1. Convert a List String where each string represents a date in the format MM/dd/yyyy to a List DateMidnight. List variable contains strings in the format MM/dd/yyyy:. List String list = new ArrayList String ();. We want to create a List DateMidNight with the strings in our list converted. List DateMidnight result = new ArrayList DateMidnight ();. Let's see it coded with op4j:. Some of...
bendingthejavaspoon.com
Bending the Java spoon: Converting the keys in a map
http://www.bendingthejavaspoon.com/2010/05/converting-keys-in-map.html
Bending the Java spoon. Op4j news and example recipes. Converting the keys in a map. Valid since: op4j 1.0. Convert all the keys in a map without changing its corresponding values. Map String,String map. Variable contains some numbers (as keys) along with their names in English language (as values):. Map = MAP [ {"1", "one"}, {"2", "two"}, {"3", "three"} ]. But notice that keys are Strings, not real. Objects, and that is precisely what we want to obtain, a. Map Integer,String newMap. Which apply both pre...
bendingthejavaspoon.com
Bending the Java spoon: Convert a List<String> to a List<DateMidnight>
http://www.bendingthejavaspoon.com/2010/12/valid-since-op4j-1.html
Bending the Java spoon. Op4j news and example recipes. Convert a List String to a List DateMidnight. Valid since: op4j 1.1. Convert a List String where each string represents a date in the format MM/dd/yyyy to a List DateMidnight. List variable contains strings in the format MM/dd/yyyy:. List String list = new ArrayList String ();. We want to create a List DateMidNight with the strings in our list converted. List DateMidnight result = new ArrayList DateMidnight ();. Let's see it coded with op4j:. Which a...
bendingthejavaspoon.com
Bending the Java spoon: Create a map from a List and generate a List with the strings convertible to Integer
http://www.bendingthejavaspoon.com/2010/12/create-map-from-list-and-generate-list.html
Bending the Java spoon. Op4j news and example recipes. Create a map from a List. And generate a List. With the strings convertible to Integer. Valid since: op4j 1.1. With two keys: "VALID" with the strings valid as integer and "INVALID" with the not valid ones. Convert the valid strings to integer. List variable contains some strings that, in some cases, represent integer numbers:. List String list = new ArrayList String ();. Map String, List String result = new LinkedHashMap String, List String ();.
unbescape.org
unbescape: powerful, fast and easy escape/unescape operations for Java
http://www.unbescape.org/faq.html
Where does unbescape come from? Is it made or backed by any software company? Does unbescape offer any type of commercial support? Can it be considered production-ready? How can I contribute to unbescape? How can I use a SNAPSHOT release of unbescape? Where does unbescape come from? Is it made or backed by any software company? Unbescape is Open Source Software created in his spare time by a Spanish Software Engineer called Daniel Fernández. Does unbescape offer any type of commercial support? You can pr...