Community backlog for Java
Expert validation
It is extremely valuable to curate the Java contents. Would you like to review these implementations?
If they can be improved, please help yourself. If you know a better way, please create a distinct entry. If they're broken, please flag them.
🗘
Idiom #5 Create a 2D Point data structureDeclare a container type for two floating-point numbers x and y |
||
|
|
|
|
Idiom #14 Pick uniformly a random floating point number in [a..b)Pick a random number greater than or equals to a, strictly inferior to b. Precondition : a < b. |
||
|
|
|
|
Idiom #254 Replace value in listReplace all exact occurrences of "foo" with "bar" in the string list x |
||
|
|
|
|
For many more Java snippets to curate, see the full list.
Docs & demos
🗘
Idiom #50 Make an infinite loopWrite a loop that has no end clause. |
||
|
|
|
|
Idiom #154 Halfway between two hex color codesFind color c, the average between colors c1, c2. |
||
|
|
|
|
Idiom #195 Pass a two-dimensional arrayPass an array a of real numbers to the procedure (resp. function) foo. Output the size of the array, and the sum of all its elements when each element is multiplied with the array indices i and j (assuming they start from one). |
||
|
|
|
|
81% of the Java snippets don't have a runnable demo yet.
For example, these implementations would need a demo URL:
Idiom #257 Traverse list backwardsPrint each index i and value x from the list items, from the last down to the first. |
||
|
|
|
|
Idiom #251 Parse binary digitsExtract integer value i from its binary string representation s (in radix 2) |
||
|
|
|
|
Idiom #274 Remove all white space charactersCreate the string t from the string s, removing all the spaces, newlines, tabulations, etc. |
||
|
|
|
|
Missing implementations
🗘A Java implementation is missing for 50 idioms out of 371 idioms.
You may help by writing a Java snippet for these idioms:
|
|
Idiom #183 Make HTTP PUT requestMake a HTTP request with method PUT to the URL u |
|
|
Idiom #323 Set HTTP request headerMake an HTTP request with method GET to the URL u, with the request header "accept-encoding: gzip", then store the body of the response in the buffer data. |
|
|
Idiom #268 User-defined operatorDefine a type vector containing three floating point numbers x, y, and z. Write a user-defined operator x that calculates the cross product of two vectors a and b. |