Dataweave Exercise: Filter Like Functions in Arrays Module – Part 1

Functions are divided into modules in dataweave, just as methods are divided into packages in Java. Today I'll show you how to use a few functions in the arrays module that are similar to but not equivalent to the filter function.

Arrays module functions that we are going to discuss are drop, dropWhile, which are introduced in the dataweave 2.2.0 version. The reason for comparing these functions to filter is that, just like filter, they also operate on an array to produce the desired result based on some criteria.

Arrays in C/C++

C++ provides a data structure, the array, which stores a fixed-size, sequential collection of elements of the same type. They are used to store similar types of elements. (The data type must be the same for all elements.) They can be used to store collections of primitive data types, such as int, float, double, char, etc. of any particular type. To add to it, an array in C or C++ can store derived data types, such as structures, pointers etc.

All arrays consist of contiguous memory locations. The lowest address corresponds to the first element, and the highest address to the last element.

Performance Analysis of ArrayList and LinkedList in Java

ArrayList and LinkedList are frequently used classes in the Java collection framework. If you know only understand basic performance comparisons of ArrayList and LinkedList, but not the minor details of these two classes, then this article is for you.

" ArrayList should be used where more search operations are required, and  LinkedList should be used where more insert and delete operation is needed."

ArrayListuses the Array data structure, and LinkedList uses the DoublyLinkedList data structure. Here, we are going to discuss how the underlying data structure affects the performance of insert, search, and delete operation on ArrayList and LinkedList.

Kotlin Primitive and Object Arrays

I initially set out to write this post because I was playing around with some reflection code and thought I found something interesting. Alas, that was definitely not the case. Instead, it was just a basic feature of Kotlin that I haven’t needed to use or focus on yet. Although this post didn’t turn out the way I wanted it to, I still think it is a nice little post to bring some clarity to this subject.

In Java, there is the concept of primitive types and their wrapped versions. Thanks to autoboxing and unboxing, types can be interchanged between their primitive and wrapped versions. In other words, in most situations, you can use a long instead of a Long or a Long instead of a long. If you didn’t notice where the capitals were in that last sentence, then I imagine it probably looked quite confusing. The wording in that sentence is also crucial. More specifically, the statement “in most situations.”

Array Functions in PHP (Part 2)

In the first part of this series, you saw some of the most used array functions that the PHP language makes available.

Fortunately, after years and years of evolution and the publication of new versions of the language this list of array functions is still long, it almost seems that it never ends.

Optimizing Memory Access With CPU Cache

Nowadays, developers pay less attention to performance because hardware has become cheaper and stronger. If developers understand some basic knowledge about CPU and memory, they can avoid simple mistakes and it is easy to improve the performance of their code.

At the end of this article, I also ask a question that I do not know the answer to, so any suggestions are welcome!

Duplicate Objects in Java: Not Just Strings

When a Java application consumes a lot of memory, it can be a problem on its own and can lead to increased GC pressure and long GC pauses. In one of my previous articles, I discussed one common source of memory waste in Java: duplicate strings. Two java.lang.String objects a and b are duplicates when a != b && a.equals(b). In other words, there are two (or more) separate strings with the same contents in the JVM memory. This problem occurs very frequently, especially in business applications. In such apps, strings represent a lot of real-world data, and yet, the respective data domains (e.g. customer names, country names, product names) are finite and often small. From my experience, in an unoptimized Java application, duplicate strings typically waste between 5 and 30 percent of the heap. However, did you ever think that instances of other classes, including arrays, can sometimes be duplicate as well, and waste a considerable amount of memory? If not, read on.

Object Duplication Scenarios

Object duplication in memory occurs whenever the number of distinct objects of a certain type is limited but the app keeps creating such objects without trying to cache/reuse the existing ones. Here are just a few concrete examples of object duplication that I've seen: