From 812353df51e98b3c2a57ee6816c0509926fca24d Mon Sep 17 00:00:00 2001 From: 86150 <86150@hunnu.edu.cn> Date: Mon, 11 May 2026 17:03:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0W8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- W8/Pair.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 W8/Pair.java diff --git a/W8/Pair.java b/W8/Pair.java new file mode 100644 index 0000000..4cd0dde --- /dev/null +++ b/W8/Pair.java @@ -0,0 +1,31 @@ +package com.example.crawler; +public class Pair { + private K key; + private V value; + public Pair(K key, V value) { + this.key = key; + this.value = value; + } + public K getKey() { + return key; + } + public void setKey(K key) { + this.key = key; + } + public V getValue() { + return value; + } + public void setValue(V value) { + this.value = value; + } + public static Pair swap(Pair pair) { + return new Pair<>(pair.getValue(), pair.getKey()); + } + @Override + public String toString() { + return "Pair{" + + "key=" + key + + ", value=" + value + + '}'; + } +} \ No newline at end of file