Learn how to perform SQL-like grouping and summarizing calculations on Java Collections (List, Map, etc).
Have you wanted to perform SQL-like operations on data in a List or a Map? Maybe computing a sum or average? Or perhaps performing an aggregate operation such as summing a group? Well, with Java 8 streams operations, you are covered for some of these.
A previous article covered sums and averages on the whole data set. In this article, we show how to use Collectors.groupingBy() to perform SQL-like grouping on tabular data.
Continue reading “Java Streams groupingBy Examples”
Use Java 8 Streams and Collectors to slice and dice lists including computing sums, averages, partitioning and more.
Java 8 provides the new Streams facility which makes many Collection operations easy. Streaming items from a collector and filtering the data are trivial. As well as are sorting, searching and computing aggregates. That is, if you are familiar with the many Collectors functions available. We present some of these functions here.
Continue reading “Using Java Collectors”
Export data from Excel spreadsheet to CSV using Java. Properly handles exporting Unicode data in the spreadsheet.
Let us look into how to convert Excel to CSV.
CSV stands for Comma-Separated-Values and is a very common format used for exchanging data between diverse applications. While the Excel Spreadsheet file format is complex (since it has to accommodate a lot more!), CSV is a simpler format representing just tabular data.
Continue reading “Convert Excel to CSV (UTF-8)”
Conditional Formatting in Excel is very useful to highlight cells based on cell value. In this easy tutorial, learn the basics of how to do so.
Color coding of cells based on a condition is very useful in Excel for highlighting areas and data points. It is one of the top tools in the arsenal of an Excel expert in making the spreadsheet look snazzy and convey crucial information. In this article, we show a simple example of how to apply conditional formatting to cells based on values.
Continue reading “Excel Color Coding Cells”
Learn how to use Excel SUMIF function to compute a sum of cells matching a condition.
SUMIF(range, criteria, [sum_range])
SUMIF computes sum of cells matching a condition.
Continue reading “Excel Formulas – SUMIF”
When reading and writing to a child process, it is necessary to execute the read and write blocks in separate threads to avoid deadlock.
In the previous part of this Java Process Guide, we looked at how to read from and write to a child process. While executing the read and write blocks in a single thread works for simple cases, we should run these in separate threads to avoid deadlocks.
Continue reading “Java Process Example Part 2”
Startup a native process from Java using Runtime. Read the output from the process and write some data to it. After you are done, terminate the process.
Have you ever run into a situation where you need to execute an OS command from inside java and read its output? You can use the Process class to do so, but there are some caveats to consider.
Continue reading “Java Process Example”
SQL Server versions and support end dates.
SQL Server Versions
The following table shows the version numbers of SQL Server since it was released for Windows platforms in 1993.
Continue reading “SQL Server Versions”
Learn about ArrayList and LinkedList performance. In this article, we test creation, addition and iteration performance of these containers.
“Don’t mistake activity with achievement.”
― John Wooden
Let us examine the performance characteristics of List Implementations – ArrayList and LinkedList. We perform the testing for a variety of list sizes from 100 items to 1M items. We use the JMH test harness to conduct the test on a single core machine. Results are presented below.
Continue reading “Java ArrayList Benchmark”
Learn about removing entries from a HashMap, including removing by key, with an iterator and bulk removal with a filter.
“To live is the rarest thing in the world. Most people exist, that is all.”
― Oscar Wilde
After covering HashMap basics, iteration and searching/sorting, let us look at a few ways of removing entries from a HashMap.
Continue reading “Java HashMap – Remove Entries”