Posts

Showing posts with the label Apache Commons

Kotlin - Map with Multiple Keys - Example

Image
Today we will show you how to implement a  Map with Multiple Keys.  Solution 1: Using Kotlin Custom Key Class Solution 2: Using Google's Guava Solution 3: Using Apache Commons Collections  Example 1: Using Kotlin Custom MultiMapKey  Here we created a custom MultiMap Key class, we can use MultiMap as a Key to map a value. object MultiKeyDemo { @JvmStatic fun main(args: Array<String>) { // Declaring the Map val table: MutableMap<MultiMapKey, String> = HashMap() // Declaring the key objects val key1 = MultiMapKey( "raw1" , "col1" ) val key2 = MultiMapKey( "raw1" , "col2" ) val key3 = MultiMapKey( "raw1" , "col3" ) // Putting the values table[key1] = "Java" table[key2] = "Kotlin" table[key3] = "Android" // Getting value by key val value2 = table[key2] println(value2)

Quarkus Export Data to CSV Example - Apache Commons

Image
Hello everyone, today we will learn how to export and download the data as a CSV file in a Quarkus we application. CSV stands for Comma-Separated-Values and it's a common format for doing a bulk data transfer between systems. For creating and parsing CSV files, we will use Apache Commons' 3rd-party library. Technologies used: Quarkus 2.2.3.final Open CSV 1.8 H2DB  Hibernate ORM panache Project directory: Maven[pom.xml]: A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details utilized by Maven to build the project. It contains default values for most projects. Some of the configurations that can be designated in the POM is the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists, and such can withal be designated. <?xml version = "1.0"