Using Pair with OpenJDK

Abstract: You can instantiate java.util.AbstractMap.SimpleEntry instead of javafx.util.Pair, even in OpenJDK or Java7 (or lesser).


--Sometimes you want to use key / value pairs, or pairs, in competitive programming. --The scripting language allows you to put multiple types of values in an array. --There is support for pairs in compilation languages, such as std :: pair in C ++, System.Collections.Generic.KeyValuePair and System.Tuple in C #, and Tuple in Crystal. --On the other hand, Java does not have pair support. --A class called javafx.util.Pair was introduced in Java8, but not in OpenJDK. --Aside: In yukicoder, my answer was once AC, but it became CE because Sun Java was changed to OpenJDK.


--There is java.util.Map.Entry with the same interface, but this cannot be instantiated. --When I investigated this, I found that I should use the class java.util.AbstractMap.SimpleEntry.

Recommended Posts

Using Pair with OpenJDK
Install OpenJDK8 with RPM
Try using GloVe with Deeplearning4j
Try using view_component with rails
Japaneseize using i18n with Rails
Using Mapper with Java (Spring)
Using PlantUml with Honkit [Docker]
Validate arguments using ArgumentCaptor with mockito
Folder compression with Scala. Using java.util.zip.ZipOutputStream.
I tried using JOOQ with Gradle
Try using Redis with Java (jar)
Using Java with AWS Lambda-Eclipse Preparation
Html5 development with Java using TeaVM
DB access using repository with SpringData.
Use cuda11.0 with pytorch using Docker
Using proxy service with Java crawling
Process Communication using AMQP with RabbitMQ
Check the operation using jetty with Maven.
Using Java with AWS Lambda-Implementation-Check CloudWatch Arguments
Notes for using BLE with iOS apps
Using Java with AWS Lambda-Implementation-Stop / Launch EC2
Salesforce data loader released with Zulu OpenJDK 11
Using JupyterLab + Java with WSL on Windows 10
I tried using Scalar DL with Docker
Try using Spring Boot with VS Code
Proxy server with squid using docker image
Notes on using FCM with Ruby on Rails
I tried using OnlineConverter with SpringBoot + JODConverter
Game development with two people using java 2
I tried using OpenCV with Java + Tomcat
Game development with two people using java 1
Using hidden type when PUT with Thymeleaf
GPU recognition with docker using WSL2 (August 2020)
Using SSIServlet with built-in Tomcat of SpringBoot 2.2.4
Asynchronous processing with Spring Boot using @Async
Try using Kong + Konga with Docker Compose.
Game development with two people using java 3
Try using the Wii remote with Java
Using Material Design for Bootstrap with Rails 5.2
Be careful when using rails_semantic_logger with unicorn
POST image with multipart / form-data using Moya