⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pair.java

📁 Java游戏高级编程!!很不错的!!!Java游戏高级编程!!很不错的
💻 JAVA
字号:
     package com.croftsoft.core.lang;

     import java.io.Serializable;

     import com.croftsoft.core.lang.NullArgumentException;

     /*********************************************************************
     * An immutable name-value pair where name is never null.
     *
     * <p>
     * Java 1.1 compatible.
     * </p>
     *
     * @version
     *   2001-09-13
     * @since
     *   2001-06-07
     * @author
     *   <a href="http://croftsoft.com/">David Wallace Croft</a>
     *********************************************************************/

     public final class  Pair
       implements Serializable
     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     {

     private static final long  serialVersionUID = 1L;

     public final String  name;

     public final String  value;

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     public String  getName  ( ) { return name;  }

     public String  getValue ( ) { return value; }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Converts an array of names to an array of Pairs with null values.
     *********************************************************************/
     public static Pair [ ]  toPairs ( String [ ]  names )
     //////////////////////////////////////////////////////////////////////
     {
       Pair [ ]  pairs = new Pair [ names.length ];

       for ( int  i = 0; i < names.length; i++ )
       {
         pairs [ i ] = new Pair ( names [ i ], null );
       }

       return pairs;
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////

     /*********************************************************************
     * Constructor method.
     *
     * @param  name
     *
     *   Must not be null.
     *
     * @param  value
     *
     *   May be null.
     *
     * @throws NullArgumentException
     *
     *   If name is null.
     *********************************************************************/
     public  Pair (
       String  name,
       String  value )
     //////////////////////////////////////////////////////////////////////
     {
       NullArgumentException.check ( this.name = name );

       this.value = value;
     }

     //////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////
     }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -