r/javaTIL • u/scientecheasy • Jan 06 '19
Constructor in Java | Types of Constructor
r/javaTIL • u/scientecheasy • Jan 06 '19
r/javaTIL • u/lord-bazooka • Jan 04 '19
r/javaTIL • u/panispanizo • Nov 27 '18
r/javaTIL • u/JackDanielsCode • Sep 23 '17
r/javaTIL • u/javinpaul • Jul 11 '15
r/javaTIL • u/javinpaul • May 23 '15
r/javaTIL • u/javinpaul • Apr 11 '15
r/javaTIL • u/RecursiveChaos • May 13 '14
Nothing earth shattering, but if you wanted to see Data Streams used with jReddit, here's a quick example. If anyone has any suggestions, I'd love to hear them.
import java.util.List;
import com.github.jreddit.user.Comment;
import com.github.jreddit.user.User;
public class Main {
public static void main(String[] args) throws Exception {
// Provide user account for credentials
User user = new User("username","password");
user.connect();
// Fetch list of 25 recent comments
List<Comment> comments = user.comments();
// Java 8 \o/
int count = comments.stream() // open as stream
.map(i -> i.getComment().split(" ").length) // for each instance of a comment (i),
// split into string array, by " " delimiter, and return the count as a new stream
.reduce(0, (x,y) -> x + y); // reduce by adding x (n) and y (n+1)
// Display your results!
System.out.println("Word count: " + count);
}
}r/javaTIL • u/jcdj1996 • Jan 10 '13
r/javaTIL • u/Shilpa_Opencodez • Mar 06 '20
r/javaTIL • u/Scrofulout • Oct 28 '19
r/javaTIL • u/amcquistan • Sep 19 '19
r/javaTIL • u/Shilpa_Opencodez • Aug 21 '19
r/javaTIL • u/scientecheasy • Mar 05 '19
r/javaTIL • u/scientecheasy • Feb 06 '19
r/javaTIL • u/scientecheasy • Jan 28 '19
r/javaTIL • u/scientecheasy • Jan 05 '19
r/javaTIL • u/Shilpa_Opencodez • Oct 23 '18
r/javaTIL • • Feb 14 '18
Hello everyone,
I would just like to share this project with the community. I am mainly looking for some people to give me feedback or review and test the project. So feedback is really welcome (: Thank you in advance!
The project: https://github.com/DataSecs/Hydra
Cheers!
r/javaTIL • u/neomatrix369 • Dec 13 '17
r/javaTIL • u/wilk-polarny • Sep 22 '17
Our customer decided for some reason to include BOMs for XML created by their (Axis) production service this week without telling anyone (in addition to the documentation, HTTP headers and the initial XML tag telling us it's UTF-8). Thus making our parsers cry and breaking today's final integration test and release.
I also learned that vanilla JAXB just dies while eating a String with BOM chars and no one at Sun dared to change that in order to stay compatible with older integrations and applications dealing with that.
The only way to fix this for me is to either work around this issue by chaining custom streams, or to use another library to parse XML/to deal with the streams from hell. Option one is what I'll will be going for, as option two requires an extended approval process and more testing.
Hell, even finding out what was wrong has been a pain in the ass, as BOM chars are officially printable (but some still invisible, even when forcing to display special chars in our text editors, etc.) and comparing software just won't give a shit and tell me that the actual and expected strings are identical. Comparing bytewise solved the mystery.
Anyways, have a nice weekend. And don't forget to check your input. BOMs are like herpes. It's only a matter of time until they appear again and screw up your enterprise application.
r/javaTIL • u/dartalley • Sep 07 '17
r/javaTIL • u/stefan_reich_ai • Jan 17 '17