<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vladimir Zakharov on Medium]]></title>
        <description><![CDATA[Stories by Vladimir Zakharov on Medium]]></description>
        <link>https://medium.com/@zakhav?source=rss-7db07b72520d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i5rZIWJaHg68gt-DqJV2Ug.jpeg</url>
            <title>Stories by Vladimir Zakharov on Medium</title>
            <link>https://medium.com/@zakhav?source=rss-7db07b72520d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:24:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zakhav/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Categorizing Java Methods With a Data Frame or: JLDD and WWADFD]]></title>
            <link>https://medium.com/@zakhav/categorizing-java-methods-with-a-data-frame-or-jldd-and-wwadfd-eb3f5d1fe223?source=rss-7db07b72520d------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb3f5d1fe223</guid>
            <category><![CDATA[dataframes]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[eclipse-collections]]></category>
            <category><![CDATA[java-collection]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Vladimir Zakharov]]></dc:creator>
            <pubDate>Thu, 19 Dec 2024 19:26:24 GMT</pubDate>
            <atom:updated>2024-12-20T04:28:38.841Z</atom:updated>
            <content:encoded><![CDATA[<h4>To Count by This and by That With a Data Frame, You Pivot</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B5X1iy6ouSFQJqBe2hGYng.jpeg" /></figure><h4>A Glossary of Terms</h4><p>Before we go any further, let’s clarify some words used above:</p><blockquote><strong>JLDD</strong> — Jet Lag Driven Development. A development challenge where the problem (and sometimes, solutions) is created by an individual experiencing jetlag as a result of conference or business travel.</blockquote><blockquote><strong>WWADFD </strong>— What Would a Data Frame Do? The question one asks when they see a JLDD solution that does some collections gymnastics. It’s an interesting challenge and it helps understand both benefits and limitations of the data frame based approach.</blockquote><blockquote><strong>Data Fame </strong>— a tabular data structure that can be manipulated programmatically. For more on Java data frames you can read <a href="https://medium.com/@zakhav/dataframe-and-one-billion-row-challenge-97b3d0255dd1">these</a> <a href="https://medium.com/@zakhav/java-kotlin-and-pandas-data-frames-walk-into-the-1brc-2191bb7bf587">blogs</a>.</blockquote><h4>Introduction</h4><p>This here blog was prompted by the <a href="https://donraab.medium.com/categorizing-methods-in-java-types-using-eclipse-collections-8aa498eedd7e">“Categorizing Methods in Java Types using Eclipse Collections”</a> blog by <a href="https://medium.com/u/df39b86e9f04">Donald Raab</a> in which he takes the concept of <a href="https://donraab.medium.com/associating-method-categories-with-emojis-in-intellij-and-javadoc-a82aebe1e903">Method Categories</a> and shows how looking at framework methods organized by their types and by categories (or by categories and then by types) can enhance one’s broad understanding of the capabilities of the framework. This approach is illustrated on a subset of the <a href="https://github.com/eclipse/eclipse-collections">Eclipse Collections</a> library.</p><p>To help understand and reason about Eclipse Collections, Don’s blog shows the method count for each type and category combination as well as method counts by category and type (that is, with the dimensions flipped). This slicing and dicing is implemented using Eclipse Collections.</p><p>Collecting and organizing the data and producing the results was a JLDD challenge. You can see the Eclipse Collections based solutions in the original blog (look for the countMethodsInClassesByCategory() method, but here we want to do this with a Data Frame — WWADFD!</p><h4>Problem Description</h4><p>Given a list of method categories and a list of types we want to produce two results: method counts by category by type and method counts by type by category. Basically, one result will be just a transposed version of the other.</p><p>The list of categories is actually a list of pairs, where the first element of each pair is the category name (like “Iterating”, “Finding”, etc.) and the second element is the set of prefixes for method names that likely belong in this category (like “each”, “forEach”, “iterator”, etc). In the Eclipse collections speak, the type of the category list is MutableList&lt;Pair&lt;String, MutableSet&lt;String&gt;&gt;&gt;. For the full contents of the list see the prefixesByCategory() method in <a href="https://donraab.medium.com/categorizing-methods-in-java-types-using-eclipse-collections-8aa498eedd7e">the original blog</a>, but here is a highly abbreviated version to give you an idea of its structure:</p><pre>public static MutableList&lt;Pair&lt;String, MutableSet&lt;String&gt;&gt;&gt; <br>prefixesByCategory()<br>{<br>    MutableList&lt;Pair&lt;String, MutableSet&lt;String&gt;&gt;&gt; list = Lists.mutable.empty();<br><br>    list.add(Tuples.pair(&quot;Iterating&quot;,<br>      Sets.mutable.with(<br>          &quot;forEach&quot;, &quot;tap&quot;, &quot;asLazy&quot;, &quot;iterator&quot;, &quot;spliterator&quot; /* ... */);<br><br>    list.add(Tuples.pair(&quot;Counting&quot;, Sets.mutable.with(&quot;count&quot;, &quot;size&quot;)));<br><br>    list.add(Tuples.pair(&quot;Testing&quot;,<br>      Sets.mutable.with(<br>          &quot;any&quot;, &quot;all&quot;, &quot;none&quot;, &quot;contains&quot;, &quot;is&quot;, &quot;not&quot;, &quot;corresponds&quot;, <br>          &quot;comparator&quot;, &quot;compareTo&quot; /* ... */)));<br><br>    list.add(Tuples.pair(&quot;Grouping&quot;, <br>      Sets.mutable.with(&quot;chunk&quot;, &quot;group&quot;, &quot;zip&quot;, &quot;partitioning&quot; /* ... */)));<br><br>    list.add(Tuples.pair(&quot;Filtering&quot;,<br>      Sets.mutable.with(<br>          &quot;select&quot;, &quot;reject&quot;, &quot;partition&quot;, &quot;filter&quot;, &quot;subList&quot; /* ... */)));<br>// ...<br>// Lots and lots more categories<br>// ...<br>    list.add(Tuples.pair(&quot;Sorting&quot;, Sets.mutable.with(&quot;sort&quot;)));<br><br>    list.add(Tuples.pair(&quot;Mutating&quot;,<br>      Sets.mutable.with(<br>          &quot;add&quot;, &quot;remove&quot;, &quot;retain&quot;, &quot;replace&quot;, &quot;clear&quot;, &quot;put&quot; /* ... */)));<br><br>  return list;<br>}</pre><p>Then for each of the types we are given we extract the names of the methods that are available on this type and select the appropriate category from the list of prefixes by category.</p><p>That leaves us with a collection of triples of &lt;method name, method type, method category&gt;, from which we can derive the desired result.</p><p>And of course we want to use a data frame! For this example I will be using the <a href="https://github.com/vmzakharov/dataframe-ec">dataframe-ec framework</a> &lt;disclaimer&gt;<em>I am the maintainer of this library</em>&lt;/disclaimer&gt;. For more on data frames in general and specifically Java data frames see <a href="https://medium.com/@zakhav/dataframe-and-one-billion-row-challenge-97b3d0255dd1">this blog</a> and <a href="https://medium.com/@zakhav/java-kotlin-and-pandas-data-frames-walk-into-the-1brc-2191bb7bf587">this blog</a>.</p><h4>Solution</h4><p>When we want to count-by something we use aggregation. When we want to count-by-and-by we use <strong>pivot</strong>.</p><p>It is actually fairly easy to create a data frame that is an equivalent of a pivot table in your favorite spreadsheet application. So let’s see explore we the pivot functionality of the dataframe-ec library.</p><p>First, let’s build a data frame containing three columns: class (or type) name, method category name, and method name. Each row of the data frame will contain an entry for each method of the types in scope.</p><pre>ClassComparer classComparer = new ClassComparer(true, false, false); <br><br>DataFrame methods = new DataFrame(&quot;methods&quot;)<br>        .addStringColumn(&quot;type&quot;)<br>        .addStringColumn(&quot;category&quot;)<br>        .addStringColumn(&quot;method&quot;);<br><br>types.forEach(<br>    type -&gt; classComparer.getMethodNames(type)<br>                     .forEach(<br>                         methodName -&gt; methods.addRow(<br>                                 type.getSimpleName(),<br>                                 categoryForMethodNamed(methodName),<br>                                 methodName)<br>                     )<br>);</pre><p>types is a variable that contains the list of classes the methods of which we want to categorize.</p><p>ClassComparer is a utility class that comes with Eclipse Collections. Here it is used to get a list of method names for a given class.</p><p>categoryForMethodNamed is the same method used in Don’s original blog and it does what it says on the tin — given a method name returns its category (by looking it up in the list of prefixes by category).</p><p>The resulting data frame will look something like this (with many rows snipped to preserve space and clarity):</p><pre>+-------------------+--------------+----------------------+<br>|type               |category      |method                |<br>+-------------------+--------------+----------------------+<br>|&quot;RichIterable&quot;     |&quot;Aggregating&quot; |&quot;aggregateBy(Funct...&quot;|<br>|&quot;RichIterable&quot;     |&quot;Testing&quot;     |&quot;allSatisfy(Predic...&quot;|<br>|&quot;RichIterable&quot;     |&quot;Testing&quot;     |&quot;anySatisfyWith(Pr...&quot;|<br>|&quot;RichIterable&quot;     |&quot;Converting&quot;  |&quot;appendString(Appe...&quot;|<br>|&quot;RichIterable&quot;     |&quot;Converting&quot;  |&quot;appendString(Appe...&quot;|<br>|&quot;RichIterable&quot;     |&quot;Iterating&quot;   |&quot;asLazy()&quot;            |<br>|&quot;RichIterable&quot;     |&quot;Grouping&quot;    |&quot;chunk(int)&quot;          |<br>|&quot;RichIterable&quot;     |&quot;Transforming&quot;|&quot;collect(Function)&quot;   |<br> ...                 ...            ...            <br>|&quot;SortedBag&quot;        |&quot;Iterating&quot;   |&quot;tap(Procedure)&quot;      |<br>|&quot;SortedBag&quot;        |&quot;Converting&quot;  |&quot;toArray()&quot;           |<br>|&quot;SortedBag&quot;        |&quot;Converting&quot;  |&quot;toReversed()&quot;        |<br> ...                 ...            ...<br>|&quot;SortedMapIterable&quot;|&quot;Grouping&quot;    |&quot;zipWithIndex()&quot;      |<br>|&quot;SortedMapIterable&quot;|&quot;Grouping&quot;    |&quot;zipWithIndex(Coll...&quot;|<br>+-------------------+--------------+----------------------+</pre><p>As our next step we calculate the number of methods for each type and category pair using the aggregateBy method:</p><pre>DataFrame methodCountByTypeAndCategory = methods.aggregateBy(<br>        Lists.immutable.of(count(&quot;method&quot;, &quot;methods&quot;)),<br>        Lists.immutable.of(&quot;type&quot;, &quot;category&quot;)<br>    );</pre><p>The result of this aggregation will be a data frame that looks like this (again, rows snipped):</p><pre>+-------------------+--------------+-------+<br>|type               |category      |methods|<br>+-------------------+--------------+-------+<br>|&quot;RichIterable&quot;     |&quot;Aggregating&quot; |     27|<br>|&quot;RichIterable&quot;     |&quot;Testing&quot;     |     17|<br>|&quot;RichIterable&quot;     |&quot;Converting&quot;  |     43|<br>|&quot;RichIterable&quot;     |&quot;Iterating&quot;   |      9|<br>|&quot;RichIterable&quot;     |&quot;Grouping&quot;    |     12|<br>|&quot;RichIterable&quot;     |&quot;Transforming&quot;|     34|<br> ...                 ...            ...<br>|&quot;LazyIterable&quot;     |&quot;Aggregating&quot; |     27|<br>|&quot;LazyIterable&quot;     |&quot;Testing&quot;     |     17|<br>|&quot;LazyIterable&quot;     |&quot;Converting&quot;  |     43|<br> ...                 ...            ...<br>|&quot;SortedMapIterable&quot;|&quot;Finding&quot;     |     34|<br>|&quot;SortedMapIterable&quot;|&quot;Filtering&quot;   |     17|<br>+-------------------+--------------+-------+</pre><p>And now, to get our final results — pivot! pivot! pivot!</p><pre>DataFrame categoryCountsByType = methodCountByTypeAndCategory<br>    .pivot(<br>            Lists.immutable.of(&quot;type&quot;),<br>            &quot;category&quot;, ASC,<br>            Lists.immutable.of(sum(&quot;methods&quot;)))<br>    .sortBy(Lists.immutable.of(&quot;type&quot;));<br><br>DataFrame typeCountsByCategory = methodCountByTypeAndCategory<br>    .pivot(<br>            Lists.immutable.of(&quot;category&quot;),<br>            &quot;type&quot;, ASC,<br>            Lists.immutable.of(sum(&quot;methods&quot;)))<br>    .sortBy(Lists.immutable.of(&quot;category&quot;));</pre><p>This version of the pivot method takes the following parameters</p><ul><li>The columns to group the aggregate values by.</li><li>The pivot column, the values of which will be the value column headers of the resulting pivot data frame.</li><li>The order in which the value (pivot) columns will appear in the result, the order of the headers. This parameter is optional, if not specified, the order in which the values appear in the original data frame will be preserved.</li><li>The aggregate functions for the values in the resulting pivot table. The values to aggregate are specified as the parameters of the aggregate functions.</li></ul><p>After we are done pivot-ing we sort the data frame by calling the sortBy method so that the rows of the resulting data frames (the types or the categories) are listed in the alphabetical order.</p><p>A couple of points to highlight. You will see that some of the parameters of the pivot method are lists. This is because dataframe-ec supports multiple group-by columns and multiple aggregation values. This is similar to what you can do in the Excel pivot tables.</p><p>Also by default where there are no values to count, dataframe-ec aggregation function count returns zero. Which seems to makes sense.</p><p>By the way, these are the pivot tables with the results:</p><p><em>Eclipse Collections Method Category Counts by Type:</em></p><pre>+-------------------+-----------+----------+--------+--------+---------+-------+--------+---------+--------+-------+------------+<br>|type               |Aggregating|Converting|Counting|Creating|Filtering|Finding|Grouping|Iterating|Set Math|Testing|Transforming|<br>+-------------------+-----------+----------+--------+--------+---------+-------+--------+---------+--------+-------+------------+<br>|&quot;Bag&quot;              |         28|        46|      10|       0|       15|     26|      12|       10|       0|     21|          36|<br>|&quot;LazyIterable&quot;     |         27|        43|       9|       1|       12|     22|      12|       13|       0|     17|          34|<br>|&quot;ListIterable&quot;     |         28|        46|       9|       0|       20|     31|      12|       22|       0|     19|          36|<br>|&quot;MapIterable&quot;      |         30|        49|       9|       0|       13|     29|      12|       14|       0|     21|          36|<br>|&quot;RichIterable&quot;     |         27|        43|       9|       0|       11|     22|      12|        9|       0|     17|          34|<br>|&quot;SetIterable&quot;      |         28|        44|       9|       0|       11|     22|      12|       10|       9|     20|          34|<br>|&quot;SortedBag&quot;        |         28|        48|      10|       0|       19|     31|      12|       19|       0|     24|          38|<br>|&quot;SortedMapIterable&quot;|         30|        51|       9|       0|       17|     34|      12|       23|       0|     23|          38|<br>|&quot;SortedSetIterable&quot;|         28|        46|       9|       0|       15|     27|      12|       19|      10|     23|          36|<br>|&quot;StackIterable&quot;    |         28|        45|       9|       0|       15|     26|      12|       16|       0|     19|          36|<br>+-------------------+-----------+----------+--------+--------+---------+-------+--------+---------+--------+-------+------------+</pre><p><em>Eclipse Collections Method Type Counts by Category:</em></p><pre>+--------------+---+------------+------------+-----------+------------+-----------+---------+-----------------+-----------------+-------------+<br>|category      |Bag|LazyIterable|ListIterable|MapIterable|RichIterable|SetIterable|SortedBag|SortedMapIterable|SortedSetIterable|StackIterable|<br>+--------------+---+------------+------------+-----------+------------+-----------+---------+-----------------+-----------------+-------------+<br>|&quot;Aggregating&quot; | 28|          27|          28|         30|          27|         28|       28|               30|               28|           28|<br>|&quot;Converting&quot;  | 46|          43|          46|         49|          43|         44|       48|               51|               46|           45|<br>|&quot;Counting&quot;    | 10|           9|           9|          9|           9|          9|       10|                9|                9|            9|<br>|&quot;Creating&quot;    |  0|           1|           0|          0|           0|          0|        0|                0|                0|            0|<br>|&quot;Filtering&quot;   | 15|          12|          20|         13|          11|         11|       19|               17|               15|           15|<br>|&quot;Finding&quot;     | 26|          22|          31|         29|          22|         22|       31|               34|               27|           26|<br>|&quot;Grouping&quot;    | 12|          12|          12|         12|          12|         12|       12|               12|               12|           12|<br>|&quot;Iterating&quot;   | 10|          13|          22|         14|           9|         10|       19|               23|               19|           16|<br>|&quot;Set Math&quot;    |  0|           0|           0|          0|           0|          9|        0|                0|               10|            0|<br>|&quot;Testing&quot;     | 21|          17|          19|         21|          17|         20|       24|               23|               23|           19|<br>|&quot;Transforming&quot;| 36|          34|          36|         36|          34|         34|       38|               38|               36|           36|<br>+--------------+---+------------+------------+-----------+------------+-----------+---------+-----------------+-----------------+-------------+</pre><h4>Parting Thoughts</h4><p>For this particular scenario, the data frame implementation does not immediately appear more concise if you compare it with the code in <a href="https://donraab.medium.com/categorizing-methods-in-java-types-using-eclipse-collections-8aa498eedd7e">the original solution</a>. However, there are scenarios where you still may prefer it to a collection based implementation. Specifically, if it seems natural to think about a particular problem and its solution in terms of tables and aggregations — like a relational table or a table in a spreadsheet — then a data frame based approach can offer an easy (to write and to read) and natural solution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb3f5d1fe223" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java, Kotlin, and Pandas Data Frames Walk into the One Billion Row Challenge]]></title>
            <link>https://medium.com/@zakhav/java-kotlin-and-pandas-data-frames-walk-into-the-1brc-2191bb7bf587?source=rss-7db07b72520d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2191bb7bf587</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[java-collection]]></category>
            <category><![CDATA[eclipse-collections]]></category>
            <category><![CDATA[dataframes]]></category>
            <dc:creator><![CDATA[Vladimir Zakharov]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 02:45:35 GMT</pubDate>
            <atom:updated>2024-12-24T19:08:38.220Z</atom:updated>
            <content:encoded><![CDATA[<h4>“It’s a Race! I hope I win…” —<em> Enrico Pollini, Rat Race (2001)</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NTnGlRdmiAO5liJilMA6Q.jpeg" /></figure><h4>Introduction</h4><p>This blog is a follow up to <a href="https://medium.com/@zakhav/dataframe-and-one-billion-row-challenge-97b3d0255dd1">DataFrame and the One Billion Row Challenge</a> (“How to use a Java DataFrame to save developer time, produce readable code, and not win any prizes”), which shows how to use a native Java DataFrame implementation to solve <a href="https://www.morling.dev/blog/one-billion-row-challenge/">the One Billion Row Challenge (1BRC)</a>.</p><blockquote><strong><em>NOTE</em></strong><em> If you are not familiar with the challenge and/or with the concept of data frames, I highly recommend checking out </em><a href="https://medium.com/@zakhav/dataframe-and-one-billion-row-challenge-97b3d0255dd1"><em>that blog</em></a><em> before continuing.</em></blockquote><p>Briefly, the goal of using a data frame was not to achieve a winning performance in the challenge, but rather to show how using data frames to solve these types of problems can minimize developer time, enhance developer experience, improve code readability, and increase maintainability.</p><p>The data frame based solution shown in the blog achieves these goals, but I was curious to see how it compares to some other data frame implementations available on the JVM as well as to the Python Pandas data frame — the framework that people probably think about first when they hear the words “data frame”.</p><p>Specifically, the comparison had two goals:</p><ol><li>To see how the data frame choices available to Java/JVM developers behaved when stressed and how their performance (processing speed and memory usage) compared to each other and to that of the “industry standard” Python/Pandas data frame.</li><li>To see how concise and expressive the code ended up for different implementations.</li></ol><h4>Meet the Contestants</h4><p>The following data frame implementations were compared:</p><ul><li><strong>Python/Pandas</strong> — used for reference.</li><li><strong>Dataframe-EC</strong> — a pure Java data frame implementation based on the <a href="https://github.com/eclipse/eclipse-collections">Eclipse Collections</a> framework. &lt;disclaimer&gt;<em>I happen to be the maintainer of Dataframe-EC</em>&lt;/disclaimer&gt;</li><li><strong>Tablesaw </strong>— another Java data frame implementation, which was selected because it seems to be used and supported.</li><li><strong>Kotlin DataFrame</strong> — a Kotlin language library for data frames. This is another option running on the JVM and Java developers may be intrigued by it (and other things Kotlin) so it seemed reasonable to throw it in the mix.</li></ul><h4>Approach: Simple — Good</h4><p>Given the solution parameters in the original blog (code simplicity, readability, developer efficiency, etc.) the goal was to use the frameworks “out of the box”. That is, the solutions would take advantage of whatever optimization tricks the framework may be doing under the covers, but no effort was made to apply heroic optimizations in the application code, like splitting the data into subsets and processing them in parallel.</p><p>So anything that would be non-obvious and/or would complicate the code was avoided. Having said that, if the framework high level APIs supported easily discoverable parameters to improve performance, I tried to use those. An example of the kind of the parameter I am talking about is specifying engine=&quot;pyarrow&quot; instead of engine=&quot;python&quot; in the pandas’ read_csv method (the pyarrow engine is the newer and faster parser engine resulting in faster load times). It’s a simple option that is easy to discover and adding it does not impact code readability.</p><p>It is also entirely possible that I missed some of those options — if so, please let me know and I will be happy to correct the solutions and post the updated results.</p><h4>The Environment</h4><ul><li>Hardware: a Windows 11 PC with an Intel Core i7–13700H CPU and 64GB of RAM</li><li>JDK 21 (Eclipse Temurin 21.0.3) used for all the JDK based solutions</li><li>Kotlin 2.0.20 and Kotlin DataFrame 0.13.1 used for the Kotlin solution</li><li>Python 3.12.4 and Pandas 2.2.2 used for the Python/Pandas based solution</li></ul><h4>The Results</h4><p>There are two sets of results: for one billion rows as well as for 100 million rows. “The 100 million row challenge” was introduced due to the Kotlin Data Frame solution running out of heap space in the environment that was used when trying to load one billion rows. The application had 52GB of heap allocated (the maximum that could be allocated on the test system). Still I wanted the Kotlin solution to be a part of the data frame comparison — hence “the 100 million row challenge”. The 1BRC results for Kotlin are marked with “DNF” (Did Not Finish) in the result tables and in the charts.</p><p>The Java data frame 1BRC solutions were tested twice: with 16G and with 32G of heap allocated. The goal was to see how they performed in a [somewhat] memory constrained environment.</p><p>The results below were obtained via a highly scientific and statistically sound (aka “good enough for this exercise”) approach of running each solution seven times, discarding the fastest and the slowest runs, and averaging the remaining five results.</p><p>The following measurements are shown:</p><ul><li>The total execution time in milliseconds.</li><li>The times for each of the two execution steps: loading data and aggregating data.</li><li>The maximum used heap* size. <br>* — For the Python/Pandas solution this value shows the total memory used by the OS process.</li></ul><p>For each challenge the results are shown as a grid and as a chart.</p><p>In the charts, the lower bars for the time values indicate faster performance and for the heap size values the lower bars indicate less memory used (so lower is better).</p><p><strong>Results: 100 Million Rows</strong></p><pre>+---------------+-------------+----------+-----------+-----------+--------+<br>|                             |            Time, ms              | Max    |<br>+---------------+-------------+----------+-----------+-----------+ Heap*, |<br>|   Framework   | VM Option   |    Total | Load Data | Aggregate | GB     |<br>+---------------+-------------+----------+-----------+-----------+--------+<br>| Python/Pandas | N/A         |    7,933 |     3,927 |     4,006 |   7.60 |<br>| Dataframe-EC  | default/16G |   17,762 |    15,020 |     2,742 |   3.71 |<br>| Tablesaw      | default/16G |   40,329 |    12,440 |    27,889 |   2.22 |<br>| Kotlin        | -Xmx32G     |   72,286 |    43,854 |    28,432 |  34.36 |<br>+---------------+-------------+----------+-----------+-----------+--------+</pre><p>Or in a chart form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cgTt66nXsBH3OrwESHd6-Q.png" /><figcaption>100 Million Row Challenge Results</figcaption></figure><p><strong>Results: One Billion Rows</strong></p><pre>+---------------+-----------+-----------+-----------+-----------+---------+<br>|                           |             Time, ms              | Max     |<br>+---------------+-----------+-----------+-----------+-----------+ Heap*,  |<br>|   Framework   | VM Option |     Total | Load Data | Aggregate | GB      |<br>+---------------+-----------+-----------+-----------+-----------+---------+<br>| Python/Pandas | N/A       |   122,443 |    49,697 |    72,747 |   58.00 |<br>| Dataframe-EC  | -Xmx16G   |   179,227 |   146,277 |    32,949 |   17.18 |<br>| Tablesaw      | -Xmx16G   |   410,149 |   121,459 |   288,689 |   17.18 |<br>| Dataframe-EC  | -Xmx32G   |   159,022 |   132,343 |    26,679 |   34.36 |<br>| Tablesaw      | -Xmx32G   |   379,519 |   112,272 |   267,248 |   22.97 |<br>| Kotlin        | -Xmx52G   |       DNF |       DNF |       DNF |     DNF |<br>+---------------+-----------+-----------+-----------+-----------+---------+</pre><p>Or in a chart form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7U1PUijHCRF7gDSBWCF1tw.png" /><figcaption>One Billion Row Challenge Results</figcaption></figure><h4>May the Source Be With You</h4><p>Here is the source code for each of the four solutions</p><p><strong>Python/Pandas Source</strong></p><pre>import pandas as pd<br><br>FILE = &quot;measurements_10.txt&quot;<br><br>if __name__ == &quot;__main__&quot;:<br>    df = pd.read_csv(<br>        FILE,<br>        sep=&quot;;&quot;,<br>        header=None,<br>        names=[&quot;Station&quot;, &quot;Temperature&quot;],<br>        engine=&#39;pyarrow&#39;<br>    )<br><br>    df = df.groupby(&quot;Station&quot;).agg([&quot;min&quot;, &quot;mean&quot;, &quot;max&quot;])<br><br>    df.columns = df.columns.droplevel()<br><br>    df = df.sort_values(&quot;Station&quot;)<br><br>    for index, row in df.iterrows():<br>        print(f&quot;{index}={row[&#39;min&#39;]:0.1f}/{row[&#39;mean&#39;]:0.1f}/{row[&#39;max&#39;]:0.1f}&quot;)</pre><p><strong>Java Dataframe-EC Source</strong></p><pre>package dftalk.onebrc.dfec;<br><br>import io.github.vmzakharov.ecdataframe.dataframe.DataFrame;<br>import io.github.vmzakharov.ecdataframe.dataset.CsvDataSet;<br>import io.github.vmzakharov.ecdataframe.dataset.CsvSchema;<br>import org.eclipse.collections.api.factory.Lists;<br><br>import java.net.URI;<br>import java.nio.file.Path;<br><br>import static io.github.vmzakharov.ecdataframe.dataframe.AggregateFunction.avg2d;<br>import static io.github.vmzakharov.ecdataframe.dataframe.AggregateFunction.max;<br>import static io.github.vmzakharov.ecdataframe.dataframe.AggregateFunction.min;<br>import static io.github.vmzakharov.ecdataframe.dsl.value.ValueType.FLOAT;<br>import static io.github.vmzakharov.ecdataframe.dsl.value.ValueType.STRING;<br><br>public class CalculateAverage<br>{<br>    static private final String FILE = &quot;onebrc/measurements_10.txt&quot;;<br><br>    public static void main(String[] args) throws Exception<br>    {<br>        URI measurementFile = CalculateAverage.class.getClassLoader()<br>                                    .getResource(FILE)<br>                                    .toURI();<br><br>        CsvSchema msSchema = new CsvSchema()<br>                .addColumn(&quot;Station&quot;, STRING)<br>                .addColumn(&quot;Temperature&quot;, FLOAT)<br>                .separator(&#39;;&#39;)<br>                .hasHeaderLine(false);<br><br>        CsvDataSet msDataSet = new CsvDataSet(Path.of(measurementFile), &quot;measurements&quot;, msSchema);<br><br>        DataFrame measurements = msDataSet.loadAsDataFrame();<br><br>        DataFrame aggregated = measurements<br>                .aggregateBy(<br>                        Lists.immutable.of(min(&quot;Temperature&quot;, &quot;Min&quot;), avg2d(&quot;Temperature&quot;, &quot;Mean&quot;), max(&quot;Temperature&quot;, &quot;Max&quot;)),<br>                        Lists.immutable.of(&quot;Station&quot;))<br>                .sortBy(Lists.immutable.of(&quot;Station&quot;));<br><br>        aggregated.forEach(row -&gt;<br>                System.out.printf(<br>                        &quot;%s=%2.1f/%2.1f/%2.1f\n&quot;,<br>                        row.getString(&quot;Station&quot;),<br>                        row.getFloat(&quot;Min&quot;),<br>                        row.getDouble(&quot;Mean&quot;),<br>                        row.getFloat(&quot;Max&quot;)));<br>    }<br>}</pre><p><strong>Java Tablesaw Source</strong></p><pre>package dftalk.onebrc.tablesaw;<br><br>import tech.tablesaw.api.ColumnType;<br>import tech.tablesaw.api.Table;<br>import tech.tablesaw.io.csv.CsvReadOptions;<br><br>import java.net.URL;<br><br>import static tech.tablesaw.aggregate.AggregateFunctions.max;<br>import static tech.tablesaw.aggregate.AggregateFunctions.mean;<br>import static tech.tablesaw.aggregate.AggregateFunctions.min;<br>import static tech.tablesaw.api.ColumnType.FLOAT;<br>import static tech.tablesaw.api.ColumnType.STRING;<br><br>public class CalculateAverage<br>{<br>    static private final String FILE = &quot;onebrc/measurements_10.txt&quot;;<br><br>    public static void main(String[] args) throws Exception<br>    {<br>        URL measurementFile = CalculateAverage.class.getClassLoader()<br>                                    .getResource(FILE);<br><br>        CsvReadOptions options = CsvReadOptions<br>                .builder(measurementFile)<br>                .columnTypes(new ColumnType[] {STRING, FLOAT})<br>                .separator(&#39;;&#39;)<br>                .header(false)<br>                .build();<br><br>        Table measurements = Table.read().usingOptions(options);<br>        measurements.column(0).setName(&quot;Station&quot;);<br>        measurements.column(1).setName(&quot;Temperature&quot;);<br><br>        Table aggregated = measurements<br>                .summarize(&quot;Temperature&quot;, min, mean, max).by(&quot;Station&quot;)<br>                .sortOn(&quot;Station&quot;);<br><br>        aggregated.forEach(row -&gt;<br>                System.out.printf(<br>                        &quot;%s=%2.1f/%2.1f/%2.1f\n&quot;,<br>                        row.getString(&quot;Station&quot;),<br>                        row.getDouble(&quot;Min [Temperature]&quot;),<br>                        row.getDouble(&quot;Mean [Temperature]&quot;),<br>                        row.getDouble(&quot;Max [Temperature]&quot;))<br>        );<br>    }<br>}</pre><p><strong>Kotlin DataFrame Source</strong></p><pre>package dftalk.onebrc.dfkotlin<br><br>import org.jetbrains.kotlinx.dataframe.DataFrame<br>import org.jetbrains.kotlinx.dataframe.api.*<br>import org.jetbrains.kotlinx.dataframe.io.readCSV<br><br>fun main() {<br>    val FILE = &quot;onebrc/measurements_10.txt&quot;<br><br>    val measurementFile = object {}::class.java.classLoader.getResource(FILE)<br><br>    val measurements = DataFrame.readCSV(<br>        measurementFile!!,<br>        header = listOf(&quot;Station&quot;, &quot;Temperature&quot;),<br>        delimiter = &#39;;&#39;<br>    );<br><br>    val aggregated = measurements.groupBy(&quot;Station&quot;)<br>        .aggregate {<br>            min(&quot;Temperature&quot;) into &quot;min&quot;<br>            mean(&quot;Temperature&quot;) into &quot;mean&quot;<br>            max(&quot;Temperature&quot;) into &quot;max&quot;<br>        }<br>        .sortBy(&quot;Station&quot;)<br><br>    aggregated.forEach {<br>        println(<br>            &quot;%s=%2.1f/%2.1f/%2.1f&quot;.format(<br>                it[&quot;Station&quot;], <br>                it[&quot;min&quot;], <br>                it[&quot;mean&quot;], <br>                it[&quot;max&quot;])<br>        )<br>    }<br>}</pre><p>If you want to try this yourself with one billion (or however many) rows, the data generation program for the challenge is available at <a href="https://github.com/gunnarmorling/1brc">the original 1BRC GitHub repo</a>.</p><h4>Observations: Performance</h4><p>So what do these solutions tell us? Let’s start with performance.</p><p><strong>Python/Pandas</strong> solution leaves everyone else in the dust — <em>if we only consider the execution time</em>. It is, however, surprisingly inefficient when it comes to memory usage.</p><p><strong>Kotlin DataFrame</strong> lags behind everyone else on every metric. My suspicion is that it suffers greatly from its underlying data structures simply proxying fairly inefficient JDK Collections.</p><p>Conversely, both DataFrame-EC and Tablesaw use optimized collection types for storing values and that shows.</p><p><strong>Tablesaw</strong> relies on the <a href="https://fastutil.di.unimi.it/"><strong>fastutil</strong></a><strong> </strong>library for storing values in primitive type columns, as well its own data structure (internally using fasutil) for the implementation of String columns.</p><p><strong>Dataframe-EC</strong> takes full advantage of <a href="https://eclipse.dev/collections/"><strong>Eclipse Collections</strong></a><strong>’</strong> highly optimized implementation of the JDK collection types as well as additional collection APIs and types, including a full complement of primitive and immutable containers.</p><p>Both Tablesaw and Dataframe-EC benefit from internal pooling of objects, which has an especially significant impact in the context of 1BRC (one billion measurement records for only 413 different stations).</p><p>Tablesaw appears to be especially efficient memory-wise and its data load performance beats that of Dataframe-EC by 10%–20%.</p><p>However, when it comes to aggregation, Tablesaw does worse than Dataframe-EC by an order of magnitude! Not sure what causes it — perhaps Tablesaw’s reliance on Apache Commons utilities for the aggregation function implementation.</p><p>When you add up these numbers, the Dataframe-EC total execution time for the 1BRC scenario ends up being more than twice as fast — all thanks to the difference in the aggregation speeds.</p><p>It is also interesting to see the performance differences for different memory sizes for the Java based 1BRC solutions. Both Dataframe-EC and Tablesaw completed the challenge comfortably with 16G heaps, but the performance improved materially (while not dramatically) with the reduced memory/GC pressure when a 32G heap was allocated.</p><h4>Observations: Source Code</h4><p>Let’s move on to the source code. And… this is going to be a very brief section!</p><p>The JVM based solutions look as concise and readable as the Python/Pandas solution, and quite close when it comes to the number of lines of code (modulo the import statements and the curly braces). The frameworks make it easy for a developer to write code for these types of tasks, and more importantly, make it easy to read it even for people not very familiar with the frameworks.</p><h4>Conclusion</h4><p>Pure Java data frame libraries are an efficient and powerful tool for data oriented programming use cases. While they may not have the popularity and the breadth of the ecosystem of their more famous Python counterpart, they are quite mature and ready to be a useful addition to any Java developer’s data manipulation toolkit for the right type problems.</p><p>Data frames are great for programmatically transforming, querying, and analyzing data in your application. Pure Java data frames could be very efficient, and you may be surprised how much data you can process on commodity hardware. So maybe you don’t need that Spark Cluster after all. Maybe you don’t need to preprocess your application data in an RDBMS in Excel. And you may need to find another excuse to add Kotlin to your project ;-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2191bb7bf587" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DataFrame And One Billion Row Challenge]]></title>
            <link>https://medium.com/@zakhav/dataframe-and-one-billion-row-challenge-97b3d0255dd1?source=rss-7db07b72520d------2</link>
            <guid isPermaLink="false">https://medium.com/p/97b3d0255dd1</guid>
            <category><![CDATA[eclipse-collections]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[dataframes]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[java-collection]]></category>
            <dc:creator><![CDATA[Vladimir Zakharov]]></dc:creator>
            <pubDate>Tue, 02 Apr 2024 19:51:09 GMT</pubDate>
            <atom:updated>2024-05-27T21:13:47.816Z</atom:updated>
            <content:encoded><![CDATA[<h3>DataFrame and The One Billion Row Challenge</h3><h4>How to use a Java DataFrame to save developer time, produce readable code, and not win any prizes.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPNDdHx1tiuzRn9NokOf4Q.png" /></figure><h3>Introduction</h3><p>This post shows how to implement a solution to The One Billion Row Challenge (1BRC) using a Java DataFrame library. The goal is not to create a competitive solution within the context of the challenge. Rather 1BRC is used as a helpful use case to illustrate some reasons for why one would want to consider using a DataFrame.</p><p>There are sections below explaining what 1BRC is about and what a DataFrame data structure is at a high level. Feel free to skip them if you are familiar with either of those.</p><h3>What is The One Billion Row Challenge (1BRC)?</h3><p>The One Billion Row Challenge (aka 1BRC) was organized by Gunnar Morling (@gunnarmorling) and ran from January 1st until January 31st 2024.</p><p>The purpose of the challenge was an exploration of how quickly one billion rows from a text file can be aggregated with Java. Quoting from the <a href="https://www.morling.dev/blog/one-billion-row-challenge/">Gunnar’s blog post </a>announcing the challenge:</p><blockquote>“Your mission, should you decide to accept it, is deceptively simple: write a Java program for retrieving temperature measurement values from a text file and calculating the min, mean, and max temperature per weather station. There’s just one caveat: the file has 1,000,000,000 rows!”</blockquote><p>The details of the challenge, the scripts to generate test data, and the submissions are hosted on GitHub here <a href="https://github.com/gunnarmorling/1brc">https://github.com/gunnarmorling/1brc</a>.</p><p>The times produced by the entries into 1BRC are nothing short of amazing. The entries placed first, second, and third completed the challenge in the reference environment (8 cores, 128 GB RAM) in 1.535, 1.587, and 1.608 seconds respectively!</p><h3>I Have Thoughts</h3><p>Looking at the 1BRC repo you will likely notice this for most submissions:</p><ol><li>They are many hundreds of lines of (well formatted) code.</li><li>It is not immediately clear <strong>how</strong> the algorithms work, although some implementations have fairly helpful comments.</li><li>It is not easy to tell just by looking at the code <strong>what</strong> the code does, even though a lot of the solutions have well factored code.</li></ol><p>This makes sense in the context of the challenge and by itself doesn’t make these solutions “bad code”. Achieving absolute peak performance will require the above “sacrifices”. It takes the use of advanced Java optimization techniques, low level APIs, the latest language features, the latest JVM features, and some dark magic.</p><p>It also requires top expertise and intimate understanding of the JVM and the compiler behavior from the developer.</p><p>And it requires a good amount of the developer’s time (spent both writing and reading the code).</p><p><strong>But what if these things — code readability, maintainability, developer time — mattered to us more than peak performance? </strong>What if the cycles spent developing, understanding, and maintaining this code by humans mattered more than achieving the absolute minimum of CPU cycles? What if we could deliver a working solution quickly and then optimize it if and when needed? Enter DataFrame.</p><h3>What Is a DataFrame?</h3><p>A data frame is a tabular data set that can be manipulated programmatically. Think of it as a database table, where different columns can contain values of different types (e.g., a string column, a numeric column, a date column).</p><p>Tabular data can be loaded as a data frame from a file, or from a database result set, or anything else that looks like a table or can be made look like a table. A data frame can also be created programmatically either by specifying its values or by transforming the existing data frames.</p><p>Java developers are well versed in data structures like the Java Collections Framework or its advanced replacements like <a href="https://eclipse.dev/collections/">Eclipse Collections</a>. While great for working with primitive types or individual properties of objects, these rich collection types and APIs operate at a low level of abstraction.</p><p>Of course, we can also define domain classes and encapsulate data set operations resulting in more readable and better factored code, but this could be a heavyweight approach for simple and/or ad hoc scenarios.</p><p>As a workaround, when looking for “flexibility”, developers may be tempted by “Map-Oriented Programming” representing objects as maps, maps of maps, and so on.</p><p>One of drawbacks of both domain classes and maps is their storage overhead. This can become problematic in situations where you deal with millions of entities.</p><p>We need something that combines the efficiency of collection frameworks with the ability to group data (the way domain objects, or maps, or relational tables, or spreadsheets do), and easily transform and organize data in our code.</p><p>Data frames offer the benefits of developer efficiency, flexibility, and code readability, and depending on the use case can offer memory savings and better performance than the alternative approaches. They are used in real-world scenarios such as data transformation, data enrichment, data validation, and reconciliation.</p><h3>About dataframe-ec</h3><p>We are about to see how we can use a DataFrame to solve 1BRC. The implementation I will use for this example is the <a href="https://github.com/vmzakharov/dataframe-ec"><strong>dataframe-ec</strong></a> framework &lt;disclaimer&gt;<em> for which I happen to be the maintainer</em> &lt;/disclaimer&gt;. This DataFrame implementation is based on the <a href="https://eclipse.dev/collections/">Eclipse Collections</a> framework (thus the “ec” in the name). By the way, I have another blog on dataframe-ec (“<a href="https://medium.com/@zakhav/set-operation-with-data-frames-4225f0abb681">Set Operations With Data Frames</a>”), which could be a fun side trail . It goes into a bit more detail about the framework and shows how to implement common set operations with it.</p><p>Another thing to note is that there are other Java DataFrame implementations, and the solution code for some of them will look very similar to what you’ll see below. Having said that, the dataframe-ec implementation of DataFrame was developed with specific goals in mind, and that explains some of the differences between it and other DataFrame libraries. Some of these goals:</p><ul><li>Memory efficiency (for practical use case, where it matters)<br>- Uses highly memory efficient Eclipse Collections <br>- Support for primitive types</li><li>Inspired by Eclipse Collections APIs and exposes Eclipse Collections types in its APIs</li><li>Intuitive, humane grammar for the expression DSL used for computed columns, filters, etc. (e.g., adding two numbers is expressed as “A + B”, as opposed to an internal DSL where you assemble an expression from Java method calls)</li></ul><h3>Solving 1BRC With a DataFrame</h3><p>The 1BRC solution can be broken into three distinct steps</p><ol><li>Load the data from the file.</li><li>Perform aggregation and sorting.</li><li>Show results on the console.</li></ol><p>Let’s use a toy example to illustrate each step. Let’s say we have a file, measurements.txt, containing the following text:</p><pre>New York City;34.1<br>New York City;24.3<br>San Francisco;22.9<br>Istanbul;5.9<br>New York City;-2.7<br>Istanbul;15.0<br>San Francisco;-5.4<br>Istanbul;13.2<br>San Francisco;35.0<br>Tauranga;17.4</pre><p>The first step, loading the data from the file, is pretty straightforward. The file format is prescribed by the requirements of 1BRC. First we are going to describe the file layout using a schema object. The data is in a CSV file (well, almost, the separator is a semicolon ‘;’) and this file has no header. The file has two columns: “Station” — the location where the temperature was taken, and “Temperature” — the measurement itself. Once we define the schema, we create a data set object pointing to an actual file with the data described by the schema. And then we load the data set into a data frame.</p><pre>String MEASUREMENT_PATH = &quot;C:/projects/1brc&quot;;<br>String MEASUREMENT_FILE = &quot;measurements.txt&quot;;<br><br>CsvSchema msSchema = new CsvSchema()<br>                .addColumn(&quot;Station&quot;, STRING)<br>                .addColumn(&quot;Temperature&quot;, FLOAT)<br>                .separator(&#39;;&#39;)<br>                .hasHeaderLine(false);<br><br>CsvDataSet msDataSet = new CsvDataSet(<br>                               Path.of(MEASUREMENT_PATH, MEASUREMENT_FILE), <br>                               &quot;measurements&quot;, <br>                               msSchema);<br><br>DataFrame measurements = msDataSet.loadAsDataFrame();</pre><p>After this code fragment is executed, the data frame measurements will contain the data loaded and parsed from the file:</p><pre>┌───────────────┬─────────────┐<br>│    Station    │ Temperature │<br>├───────────────┼─────────────┤<br>│ New York City │        34.1 │<br>│ New York City │        24.3 │<br>│ San Francisco │        22.9 │<br>│ Istanbul      │         5.9 │<br>│ New York City │        -2.7 │<br>│ Istanbul      │          15 │<br>│ San Francisco │        -5.4 │<br>│ Istanbul      │        13.2 │<br>│ San Francisco │          35 │<br>│ Tauranga      │        17.4 │<br>└───────────────┴─────────────┘</pre><p>The second step is aggregating and sorting data. We will use a version of the aggregateBy method to perform our aggregation. This version takes a list of aggregators as its first parameter. Here we use built in factory methods to create aggregators, each factory method takes two parameters — the name of the column with the source data and the name of the column in the aggregated data frame, which will store the aggregation results. The second parameter of aggregateBy is the list of columns (in this case just one) to group by the aggregation, similar to the GROUP BY clause in a SELECT SQL statement.</p><p>Sorting of the aggregated DataFrame is performed by calling the sortBy method with the list of columns (again just one in this case) to sort it by as a parameter.</p><pre>DataFrame aggregated = measurements<br>    .aggregateBy(<br>        Lists.immutable.of(<br>            min(&quot;Temperature&quot;, &quot;Min&quot;), avg2d(&quot;Temperature&quot;, &quot;Mean&quot;), max(&quot;Temperature&quot;, &quot;Max&quot;)<br>        ),<br>        Lists.immutable.of(&quot;Station&quot;))<br>    .sortBy(Lists.immutable.of(&quot;Station&quot;));</pre><p>After aggregateBy is called the result looks like this:</p><pre>┌───────────────┬──────┬──────────┬──────┐<br>│    Station    │ Min  │   Mean   │ Max  │<br>├───────────────┼──────┼──────────┼──────┤<br>│ New York City │ -2.7 │ 18.56667 │ 34.1 │<br>│ San Francisco │ -5.4 │     17.5 │   35 │<br>│ Istanbul      │  5.9 │ 11.36667 │   15 │<br>│ Tauranga      │ 17.4 │     17.4 │ 17.4 │<br>└───────────────┴──────┴──────────┴──────┘</pre><p>and after sortBy(Lists.immutable.of(&quot;Station&quot;)) the data frame aggregated looks like this:</p><pre>┌───────────────┬──────┬──────────┬──────┐<br>│    Station    │ Min  │   Mean   │ Max  │<br>├───────────────┼──────┼──────────┼──────┤<br>│ Istanbul      │  5.9 │ 11.36667 │   15 │<br>│ New York City │ -2.7 │ 18.56667 │ 34.1 │<br>│ San Francisco │ -5.4 │     17.5 │   35 │<br>│ Tauranga      │ 17.4 │     17.4 │ 17.4 │<br>└───────────────┴──────┴──────────┴──────┘</pre><p>And finally iterating over the aggregated data and printing the contents is done using the forEach iterator method. This method takes as a parameter a procedure (a Consumer). This procedure is called for each row in the data frame and accepts an object representing the current row (or cursor) that can be used to extract column values from that row.</p><pre>aggregated.forEach(c -&gt;<br>    System.out.printf(<br>        &quot;%s=%2.1f/%2.1f/%2.1f\n&quot;,<br>        c.getString(&quot;Station&quot;), c.getFloat(&quot;Min&quot;), c.getDouble(&quot;Mean&quot;), c.getFloat(&quot;Max&quot;)));</pre><p>This code will produce this output on the console:</p><pre>Istanbul=5.9/11.4/15.0<br>New York City=-2.7/18.6/34.1<br>San Francisco=-5.4/17.5/35.0<br>Tauranga=17.4/17.4/17.4</pre><p>And now let’s bring all these bits together into a complete solution:</p><pre>package onebr;<br><br>import io.github.vmzakharov.ecdataframe.dataframe.DataFrame;<br>import io.github.vmzakharov.ecdataframe.dataset.CsvDataSet;<br>import io.github.vmzakharov.ecdataframe.dataset.CsvSchema;<br>import org.eclipse.collections.api.factory.Lists;<br><br>import java.nio.file.Path;<br><br>import static io.github.vmzakharov.ecdataframe.dataframe.AggregateFunction.*;<br>import static io.github.vmzakharov.ecdataframe.dsl.value.ValueType.FLOAT;<br>import static io.github.vmzakharov.ecdataframe.dsl.value.ValueType.STRING;<br><br>public class CalculateAverage<br>{<br>    static private final String MEASUREMENT_PATH = &quot;C:/projects/1brc&quot;;<br>    static private final String MEASUREMENT_FILE = &quot;measurements.txt&quot;;<br><br>    public static void main(String[] args)<br>    {<br>        CsvSchema msSchema = new CsvSchema()<br>                .addColumn(&quot;Station&quot;, STRING)<br>                .addColumn(&quot;Temperature&quot;, FLOAT)<br>                .separator(&#39;;&#39;)<br>                .hasHeaderLine(false);<br><br>        CsvDataSet msDataSet = new CsvDataSet(<br>                Path.of(MEASUREMENT_PATH, MEASUREMENT_FILE), &quot;measurements&quot;, msSchema);<br><br>        DataFrame measurements = msDataSet.loadAsDataFrame();<br><br>        DataFrame aggregated = measurements<br>                .aggregateBy(<br>                        Lists.immutable.of(min(&quot;Temperature&quot;, &quot;Min&quot;), avg2d(&quot;Temperature&quot;, &quot;Mean&quot;), max(&quot;Temperature&quot;, &quot;Max&quot;)),<br>                        Lists.immutable.of(&quot;Station&quot;))<br>                .sortBy(Lists.immutable.of(&quot;Station&quot;));<br><br>        aggregated.forEach(c -&gt;<br>                System.out.printf(<br>                        &quot;%s=%2.1f/%2.1f/%2.1f\n&quot;,<br>                        c.getString(&quot;Station&quot;), c.getFloat(&quot;Min&quot;), c.getDouble(&quot;Mean&quot;), c.getFloat(&quot;Max&quot;)));<br>    }<br>}</pre><p>For funsies, the code in the main method above can easily be written as a single statement, but I would not recommend it.</p><h3>Conclusion</h3><p>Like I promised at the beginning, this implementation will not win any performance or memory efficiency prizes in anything like 1BRC. However, one metric by which it does really well is the developer time and effort and the resulting code readability. Following the “Make it work, make it right, make it fast” maxim, more optimization can be implemented later if and when and where required. A DataFrame is not a universal solution to all problems but it is a helpful solution to enough problems in enough contexts that it pays to have it as another tool in your development toolbox.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97b3d0255dd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Set Operation with Data Frames]]></title>
            <link>https://medium.com/@zakhav/set-operation-with-data-frames-4225f0abb681?source=rss-7db07b72520d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4225f0abb681</guid>
            <category><![CDATA[java-collection]]></category>
            <category><![CDATA[dataframes]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[eclipse-collections]]></category>
            <dc:creator><![CDATA[Vladimir Zakharov]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 19:58:02 GMT</pubDate>
            <atom:updated>2024-04-02T00:52:47.457Z</atom:updated>
            <content:encoded><![CDATA[<h3>Set Operations With Data Frames</h3><h4>If the only tool you have is a data frame…</h4><figure><img alt="A drawing of a hammer contemplating a collection of Venn diagrams" src="https://cdn-images-1.medium.com/max/1024/1*47le9Zj34myZhw8IQ2w93w.png" /></figure><h4>Introduction</h4><p><a href="https://donraab.medium.com/">Don Raab</a> recently posted a <a href="https://blog.stackademic.com/comparing-set-operations-between-java-and-eclipse-collections-92cf1df28d3b">blog</a> comparing set operations between the Java Collections Framework that comes with the JDK and <a href="https://eclipse.dev/collections/">Eclipse Collections</a>.</p><p>Paul King followed it up with a <a href="https://groovy.apache.org/blog/set-operations-with-groovy">blog </a>of his own, showing how to do same (and more) operations in Groovy.</p><p>I was curious what it would looks like to implement these operations using a data frame. A data frame is basically a tabular data set that can be manipulated programmatically. Think of it as a logical equivalent of a database table, where columns can contain values of different types (unlike, say, a two-dimensional array in Java).</p><p>This post will show how to perform the set operations using a Java data frame implementation — in this case I will use the <a href="https://github.com/vmzakharov/dataframe-ec">dataframe-ec</a> framework, &lt;disclaimer&gt; for which I happen to be the maintainer &lt;/disclaimer&gt;. Dataframe-ec internally uses Eclipse Collections and exposes Eclipse Collection data structures, taking advantage of Eclipse Colections efficiency and rich APIs.</p><p>Note that if you are dealing with a single list (vector) of values then using a data frame for these operations is most likely an overkill and you are going to be better off using Eclipse Collections (if available in your environment) or one of the JDK based approaches.</p><p>In his blog Don used sets of emojis corresponding to the months of the Fall season. To make the examples here more data-frame-y we are going to have a data frame with two columns — emojis and their descriptions — for each of the three months.</p><h4>Setting Up Data (Frames)</h4><p>Following Don’s example we need to define three data frames to store three sets of emojis.</p><pre>private static DataFrame DF_OCTOBER;<br>private static DataFrame DF_NOVEMBER;<br>private static DataFrame DF_DECEMBER;</pre><p>To make it a tad more interesting we are going to use three different approaches for loading data into a data frame:</p><ol><li>Load data by columns</li><li>Load data by rows</li><li>Load data from a CSV file. For these examples we want the code to be self contained so we are going to “fake” having an actual file in the file system. Instead we will override the createReader() method on the instance of the CsvDataSet class used to create the data frame so that the data will be read from a literal string (see below) rather than from a file.</li></ol><p>Methods 1 and 2 are especially convenient for loading unit test data. In real life scenarios you probably want to load data frame from a file (that is, like method 3 but with an actual file) or programmatically.</p><pre>DF_OCTOBER = new DataFrame(&quot;October&quot;)<br>    .addStringColumn(<br>      &quot;Emoji&quot;,<br>      Lists.immutable.of(&quot;🍁&quot;, &quot;🍃&quot;, &quot;🎃&quot;, &quot;🥧&quot;, &quot;🍫&quot;, &quot;🌝&quot;, <br>                         &quot;👻&quot;, &quot;🌽&quot;, &quot;🍎&quot;, &quot;🪵&quot;, &quot;☕️&quot;))<br>    .addStringColumn(<br>      &quot;Text&quot;,<br>      Lists.immutable.of(&quot;maple leaf&quot;, &quot;leaf in the wind&quot;, &quot;pumpkin&quot;, &quot;pie&quot;, &quot;chocolate&quot;, &quot;moon face&quot;, <br>                         &quot;ghost&quot;, &quot;corn&quot;, &quot;apple&quot;, &quot;log&quot;, &quot;coffee&quot;));<br>DF_OCTOBER.seal();<br><br>DF_NOVEMBER = new DataFrame(&quot;November&quot;)<br>        .addStringColumn(&quot;Emoji&quot;).addStringColumn(&quot;Text&quot;)<br>        .addRow(&quot;🍂&quot;, &quot;fallen leaf&quot;)<br>        .addRow(&quot;🍁&quot;, &quot;maple leaf&quot;)<br>        .addRow(&quot;🥧&quot;, &quot;pie&quot;)<br>        .addRow(&quot;🦃&quot;, &quot;turkey&quot;)<br>        .addRow(&quot;🌽&quot;, &quot;corn&quot;)<br>        .addRow(&quot;🍎&quot;, &quot;apple&quot;)<br>        .addRow(&quot;🪵&quot;, &quot;log&quot;)<br>        .addRow(&quot;☕️&quot;, &quot;coffee&quot;)<br>        ;<br><br>DF_DECEMBER = new CsvDataSet(&quot;&quot;, &quot;December&quot;) {<br>          @Override<br>          protected Reader createReader() {<br>              return new StringReader(&quot;&quot;&quot;<br>                      Emoji,Text<br>                      🥧, &quot;pie&quot;<br>                      🦃, &quot;turkey&quot;<br>                      ⛄️, &quot;snowman&quot;<br>                      🍎, &quot;apple&quot;<br>                      🌰, &quot;chestnut&quot;<br>                      🛷, &quot;sled&quot;<br>                      🪵, &quot;log&quot;<br>                      🎄, &quot;tree&quot;<br>                      ☕️, &quot;coffee&quot;<br>                      &quot;&quot;&quot;);<br>          }<br>  }.loadAsDataFrame();</pre><h4>Refresher: Set Operations</h4><p>We will look at the following four set operations here</p><ol><li><strong>Union</strong>. The union of a collection of sets is a set of all elements in them. For two sets A and B, the union of those sets, <strong><em>A </em>∪ <em>B</em> </strong>in the set algebra notation, is a set that contains elements that are either in A, in B, or in both A and B.</li><li><strong>Intersection</strong>. The intersection of sets two sets A and B, <strong><em>A </em>∩ <em>B</em></strong>, is a set that contains elements in A that are also in B (or equivalently, elements in B that are also in A).</li><li><strong>Difference (Relative Complement)</strong>. For two sets A and B the set difference of A and B, aka the relative complement of B in A, <strong><em>A</em>∖<em>B</em></strong><em>,</em><strong><em> </em></strong>is the set of elements in A that are not in B.</li><li><strong>Symmetric Difference</strong>. The symmetric difference of two sets A and B, <strong><em>A </em>△ <em>B,</em></strong> is the set of elements which are either in A or in B but not in their intersection.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzKRVWQ_sZBIZhqAcU9Mng.png" /><figcaption>Venn diagrams of the aforementioned four set operations</figcaption></figure><h4>Union</h4><p>The union operation implemented in dataframe-ec is more like the UNION ALL database operation in that it will not remove duplicate rows. To get rid of the duplicates we are going to call the distinct() method on the end result of union-ing our three data frames.</p><pre>@Test<br>public void union()<br>{<br>    DataFrame union = DF_OCTOBER<br>      .union(DF_NOVEMBER)<br>      .union(DF_DECEMBER)<br>      .distinct();<br><br>    DataFrameUtil.assertEqualsIgnoreOrder(<br>            new DataFrame(&quot;expected&quot;)<br>                    .addStringColumn(&quot;Emoji&quot;).addStringColumn(&quot;Text&quot;)<br>                    .addRow(&quot;☕️&quot;, &quot;coffee&quot;)<br>                    .addRow(&quot;⛄️&quot;, &quot;snowman&quot;)<br>                    .addRow(&quot;🌝&quot;, &quot;moon face&quot;)<br>                    .addRow(&quot;🌰&quot;, &quot;chestnut&quot;)<br>                    .addRow(&quot;🌽&quot;, &quot;corn&quot;)<br>                    .addRow(&quot;🍁&quot;, &quot;maple leaf&quot;)<br>                    .addRow(&quot;🍂&quot;, &quot;fallen leaf&quot;)<br>                    .addRow(&quot;🍃&quot;, &quot;leaf in the wind&quot;)<br>                    .addRow(&quot;🍎&quot;, &quot;apple&quot;)<br>                    .addRow(&quot;🍫&quot;, &quot;chocolate&quot;)<br>                    .addRow(&quot;🎃&quot;, &quot;pumpkin&quot;)<br>                    .addRow(&quot;🎄&quot;, &quot;tree&quot;)<br>                    .addRow(&quot;👻&quot;, &quot;ghost&quot;)<br>                    .addRow(&quot;🛷&quot;, &quot;sled&quot;)<br>                    .addRow(&quot;🥧&quot;, &quot;pie&quot;)<br>                    .addRow(&quot;🦃&quot;, &quot;turkey&quot;)<br>                    .addRow(&quot;🪵&quot;, &quot;log&quot;)<br>            ,<br>            union<br>    );<br>}</pre><p>DataFrame.assertEqualsIgnoreOrder(...) is a utility method that does pretty much what it says on the tin.</p><h4>Intersection</h4><p>There is no specific intersection operation in dataframe-ec, however there is a join operation that can produce the same result. The join operation on a data frame takes as its parameters the data frame to join to and lists of columns in each data frame to join by (the join keys). This operation is a logical equivalent of a relational inner join, so rows for which there is no match in the other data frame will not be present in the join — which is exactly what we expect from the intersection of two sets. Here we are computing the intersection of all three data frames (OCTOBER <strong>∩ </strong>NOVEMBER<strong>∩ </strong>DECEMBER) so we are calling join twice.</p><pre>@Test<br>public void intersection()<br>{<br>    DataFrame intersection = DF_OCTOBER<br>            .join(DF_NOVEMBER, <br>                  Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;), <br>                  Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;))<br>            .join(DF_DECEMBER, <br>                  Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;), <br>                  Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;));<br><br>    DataFrameUtil.assertEqualsIgnoreOrder(<br>            new DataFrame(&quot;Expected&quot;)<br>                    .addStringColumn(&quot;Emoji&quot;).addStringColumn(&quot;Text&quot;)<br>                    .addRow(&quot;☕️&quot;,&quot;coffee&quot;)<br>                    .addRow(&quot;🍎&quot;,&quot;apple&quot;)<br>                    .addRow(&quot;🥧&quot;,&quot;pie&quot;)<br>                    .addRow(&quot;🪵&quot;,&quot;log&quot;)<br>            , intersection<br>    );<br>}</pre><h4>Difference (Complement)</h4><p>This follows the example from the original blog that computes the difference of three sets (that is, for example, the elements in OCTOBER that are not in NOVEMBER nor in DECEMBER). dataframe-ec does not have a separate difference operation but it does have a more general joinWithComplements operation, which for two data frames computes the intersection and the respecitve complements of these sets based on the provided keys. The results are returned as a triplet (an Eclipse Collection data structure) of data frames, containing</p><ol><li>The complement of the data frame B in A (the difference <strong><em>A </em>∖ <em>B</em></strong>)</li><li>The intersection of A and B (<strong><em>A </em>∩ <em>B</em></strong><em>, </em>the join of two data frames)</li><li>The complement of the data frame A in B (the difference <strong><em>B </em>∖ <em>A</em></strong>)</li></ol><p>So if we are only looking for the set difference we can just pick the first element of the triplet and ignore the rest:</p><pre>@Test<br>public void difference()<br>{<br>    // entires in october that are not in november<br>    DataFrame octoberComplementInNovember = DF_OCTOBER<br>            .joinWithComplements(<br>                    DF_NOVEMBER, <br>                    Lists.immutable.of(&quot;Emoji&quot;), Lists.immutable.of(&quot;Emoji&quot;)<br>            ).getOne();<br><br>    // entires in october that are neither in november nor december<br>    DataFrame octoberComplementInNovemberAndDecember = octoberComplementInNovember<br>            .joinWithComplements(<br>                    DF_DECEMBER, <br>                    Lists.immutable.of(&quot;Emoji&quot;), Lists.immutable.of(&quot;Emoji&quot;)<br>            ).getOne();<br><br>    DataFrameUtil.assertEquals(<br>            new DataFrame(&quot;Expected&quot;)<br>                    .addStringColumn(&quot;Emoji&quot;).addStringColumn(&quot;Text&quot;)<br>                    .addRow(&quot;🌝&quot;,&quot;moon face&quot;)<br>                    .addRow(&quot;🍃&quot;,&quot;leaf in the wind&quot;)<br>                    .addRow(&quot;🍫&quot;,&quot;chocolate&quot;)<br>                    .addRow(&quot;🎃&quot;,&quot;pumpkin&quot;)<br>                    .addRow(&quot;👻&quot;,&quot;ghost&quot;),<br>            octoberComplementInNovemberAndDecember<br>    );<br>}</pre><h4>Symmetric Difference</h4><p>We are going to use joinWithComplements to compute the symmetric difference of two sets. The symmetric difference of two sets is equivalent to to the union of their respective relative complements or in set algebra notation:<strong><em> <br>A △ B = </em>(<em>A </em>∖ <em>B</em>)<em> </em>⋃ (<em>B </em>∖ <em>A</em>)</strong></p><p>So taking advantage of that, the symmetric difference between OCTOBER and NOVEMBER can be computed as follows:</p><pre>@Test<br>public void symmetricDifference()<br>{<br>    Triplet&lt;DataFrame&gt; split = DF_OCTOBER.joinWithComplements(<br>              DF_NOVEMBER, <br>              Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;), <br>              Lists.immutable.of(&quot;Emoji&quot;, &quot;Text&quot;));<br><br>    DataFrame symmetricDifference = split.getOne().union(split.getThree());<br><br>    DataFrameUtil.assertEquals(<br>            new DataFrame(&quot;Expected&quot;).addStringColumn(&quot;Emoji&quot;).addStringColumn(&quot;Text&quot;)<br>                    .addRow(&quot;🌝&quot;,&quot;moon face&quot;)<br>                    .addRow(&quot;🍃&quot;,&quot;leaf in the wind&quot;)<br>                    .addRow(&quot;🍫&quot;,&quot;chocolate&quot;)<br>                    .addRow(&quot;🎃&quot;,&quot;pumpkin&quot;)<br>                    .addRow(&quot;👻&quot;,&quot;ghost&quot;)<br>                    .addRow(&quot;🍂&quot;,&quot;fallen leaf&quot;)<br>                    .addRow(&quot;🦃&quot;,&quot;turkey&quot;)<br>            , symmetricDifference<br>    );<br>}</pre><h4>Conclusion</h4><p>Data frames are useful data structures for ad hoc manipulation of tabular data, making it easy to try things like filtering, aggregation, transformation, enrichment — the types of things you might want to use excel tables for. Unlike excel based data manipulation though, these ad-hoc transformations can then be captured natively in your program in the same language as the rest of the application. There is no need to define classes or records, there is no need to know exactly what each column type is.</p><p>Dataframe-EC is an implementation of the data frame data structure in Java. To learn more about it see <a href="https://github.com/vmzakharov/dataframe-ec">the project home on GitHub</a>. For more realistic data frame operation scenarios and a way to learn data frame APIs take a look at the <a href="https://github.com/vmzakharov/dataframe-ec-kata">Dataframe-EC code kata</a>.</p><p>While this implementation of the data frame data structure does not support set operations directly, all common set operations can be relatively easily performed with it. Of course for single lists of values the native implementation of sets results in more concise and more efficient code, especially if a framework like Eclipse Collections is used.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4225f0abb681" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eclipse Collections Now Supports Indirect Sorting of Primitive Lists]]></title>
            <link>https://medium.com/javarevisited/eclipse-collections-now-supports-indirect-sorting-of-primitive-lists-e2447ca5dbc3?source=rss-7db07b72520d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2447ca5dbc3</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[eclipse-collections]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Vladimir Zakharov]]></dc:creator>
            <pubDate>Thu, 30 Jul 2020 16:33:29 GMT</pubDate>
            <atom:updated>2020-08-06T15:14:33.773Z</atom:updated>
            <content:encoded><![CDATA[<h4>Sometimes the best way to get results is to be indirect</h4><figure><img alt="Matryoshka dolls arranged by size" src="https://cdn-images-1.medium.com/max/1024/1*rg7LfNQR1BCTPRPDTpYKJg.jpeg" /></figure><p>I have recently implemented indirect sort functionality on primitive list types, which are some of many collection types supported by the <a href="https://www.eclipse.org/collections/">Eclipse Collections </a><a href="https://github.com/eclipse/eclipse-collections">project</a>.</p><p>There was a sort functionality on the primitive collections before, the sortThis() method, which is a wrapper around the Java JDK Arrays.sort method. The limitation, which was carried over into the primitive list implementation, is that it could only <a href="https://www.java67.com/2014/08/4-examples-to-sort-array-in-java.html">sort an array</a> by its elements and by the elements’ natural order, rather than by a function of its elements and/or some custom comparator.</p><p>Why would you want to sort by anything other than by the natural order of value of the element? Here are some possible reasons:</p><ul><li>Reverse sorting</li><li>Sorting by absolute value</li><li>Building an index into an ordered data structure that is impossible or impractical to reorder (e.g., a tabular data set implemented as in in-memory columnar store)</li></ul><p>This also supports the functionality described in an old open feature request for the JDK (see “<em>(coll) Arrays.sort cannot sort primitive arrays with a comparator</em>” <a href="https://bugs.openjdk.java.net/browse/JDK-4709823">https://bugs.openjdk.java.net/browse/JDK-4709823</a>).</p><p>There are three new versions of the sortThis method: the regular one supporting comparator, one supporting the “by” pattern that takes an extractor function, and a combination of both. This fills the symmetry gap that existed between primitive and object collection APIs.</p><p>If the words ‘“by” pattern’ and ‘symmetry gap’ make little sense to you, please see these blogs by <a href="https://medium.com/u/df39b86e9f04">Donald Raab</a> for explanation:</p><ul><li>Introducing the concept of Symmetry: <a href="https://medium.com/@donraab/symmetric-sympathy-2c59d4541d60">Symmetric Sympathy</a></li><li>More on Symmetry: <a href="https://medium.com/oracledevs/finding-symmetry-27944c74b6d4">Finding Symmetry</a></li><li>“By” methods: <a href="https://medium.com/javarevisited/by-yourself-some-time-e16c0f488847">By Yourself Some Time</a></li></ul><p>Here are the three new sort API methods on MutableIntList listed after the old sortThis() method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccf3cd18525bb0a40cff427d69dff8c3/href">https://medium.com/media/ccf3cd18525bb0a40cff427d69dff8c3/href</a></iframe><p>Equivalent APIs have been introduced for all other mutable primitive list types with the exception of MutableBooleanList, which does not support sorting.</p><p>These are some examples of the usage of the new APIs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3e468edf7d229a5cb113e5dbeff7dbe/href">https://medium.com/media/d3e468edf7d229a5cb113e5dbeff7dbe/href</a></iframe><p>The new sort methods are available starting with the release 10.3 of <a href="https://www.eclipse.org/collections/">Eclipse Collections</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2447ca5dbc3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/eclipse-collections-now-supports-indirect-sorting-of-primitive-lists-e2447ca5dbc3">Eclipse Collections Now Supports Indirect Sorting of Primitive Lists</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>