Cyber Whale

Top 5 useful Java Libs

Java is an advanced language, but nonetheless there are libs to make life even more easier. We would like to share 5 useful libs to help you with

javalibstipDevelopment tips

Top 5 useful Java Libs

Java is an advanced language, but nonetheless there are libs to make life even more easier. We would like to share 5 useful libs to help you with projects of different kind.

FileUtils – Apache Commons

Small but a very useful lib to help you deal with files. Simplifies working with files in a great way, making you productive and avoiding boilerplate code.

FileUtils.readLines(new File(“myfile.txt”));FileUtils.readLines(new File(“myfile.txt”));

String Utils – Apache Commons

Also small but powerful library. Has all string methods you always lack.

String title = StringUtils.substringBetween(someText, “The”, “end”);String title = StringUtils.substringBetween(someText, “The”, “end”);

Jsoup Library

This is the best Java library for parsing HTML and XML, or other markup in general.

Document doc = Jsoup.connect(“http://example.com/“).get(); String title = doc.title();Document doc = Jsoup.connect(“http://example.com/“).get(); String title = doc.title();

OpenCSV

Parsing CSV is a trivial task, but sometimes still cause trouble. OpenCSV is a minimalistic library to help you with this.

CSVReader reader = new CSVReader(new FileReader(“yourfile.csv”)); String[] nextLine; while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line System.out.println(nextLine[0] + nextLine[1] + “etc…”); }CSVReader reader = new CSVReader(new FileReader(“yourfile.csv”)); String[] nextLine; while ((nextLine = reader.readNext()) != null) { // nextLine[] is an array of values from the line System.out.println(nextLine[0] + nextLine[1] + “etc…”); }

org.json

You usually do a lot of networking in Java, but what you really need is a good JSON parser/manager. Org.json is a popular and minimalistic Java library for operating with JSON data.

String str = ”{ “firstName”: “Vladimir”, “age”: 30 }”; JSONObject obj = new JSONObject(str); String n = obj.getString(“firstName”); int a = obj.getInt(“age”); System.out.println(n + ” ” + a); // prints “Vladimir 30”String str = ”{ “firstName”: “Vladimir”, “age”: 30 }”; JSONObject obj = new JSONObject(str); String n = obj.getString(“firstName”); int a = obj.getInt(“age”); System.out.println(n + ” ” + a); // prints “Vladimir 30”

We would also point out other libs like fasterxml, FileNameUtils and Unirest.

Hope you’ll find these minimalistic java libs helpful and powerful.

Anyway you can check with us to see if we can help you develop your java application.

By adminjavalibstip

Recent Posts

Archive

Tags

#CloudTechnologies #Code #CyberWhale #GenerativeAI Analytics bi Big Data Business Business growth business intelligence Cambrian Explosion Cloud data Data Capture Data Management Data Science Data Stack Data Synchronization Data Systems Data Warehouse DBLog deeplearning4j development dev tools DoorDash ELT ETL Hacks java jobs libs machine learning parsing Production python request Retail SaaS scala Strategy tip tutorial Uber word2vec xml

AI Strategy & Consulting

Build a future-ready AI strategy with trusted guidance