🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15650

Creating a method with an integral data type

#15650
From: Bruce Lester
Date: Wed, 19 May 1999 00:00
21 lines
1222 bytes
I am wondering if there is any way in Java to create a method that is
specialized on an integral data type - an integer for example:

class Junk {
    String getText1(integer 1)
        return "one";
    } // method getText1

    String getText2(integer 2)
        return "two";
    } // method getText2

} // class Junk

I used a language called LISP with CLOS that allowed method specialization
based on integral values.  This elminates the need for if logic.

Just wondering if Java has any way to do this - or accomplish the same thing
without ifs.

Thanks.
Technical Details
Message-ID: <0AD03.335$gA3.28685@ptah.visi.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,3154d68713798bec,start
X-Google-Attributes: gidf74b3,public
From: "Bruce Lester" <blester@tcinternet.net>
Subject: Creating a method with an integral data type
Date: 1999/05/19
Message-ID: <0AD03.335$gA3.28685@ptah.visi.com>
X-Deja-AN: 479721474
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: admin@TCINTERNET.NET
X-Trace: ptah.visi.com 927139196 209.98.215.186 (Wed, 19 May 1999 13:39:56 CDT)
X-MSMail-Priority: Normal
NNTP-Posting-Date: Wed, 19 May 1999 13:39:56 CDT
Newsgroups: borland.public.jbuilder.java.language