• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

indexOf

 
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.cs.duke.edu/csl/docs/jgl/api/COM.objectspace.jgl.examples.ArrayExamples.html

I think there is a problem in their code:

/**
* Counting, finding, replacing, removing.
*
* @see COM.objectspace.jgl.Array
* @version 2.0.1
* @author ObjectSpace, Inc.
*/



array.indexOf( "bat" );!!

Is it right?
 
lowercase baba
Posts: 13069
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is an error...the above code won't compile.
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

abalfazl hossein wrote:http://www.cs.duke.edu/csl/docs/jgl/api/COM.objectspace.jgl.examples.ArrayExamples.html

I think there is a problem in their code:

/**
* Counting, finding, replacing, removing.
*
* @see COM.objectspace.jgl.Array
* @version 2.0.1
* @author ObjectSpace, Inc.
*/

array.indexOf( "bat" );!!

Is it right?



Well, I googled and found the javadoc for the Array class in question...

http://www.cs.duke.edu/csl/docs/jgl/api/COM.objectspace.jgl.Array.html

That line of code does look valid -- meaning there is a indexOf() method, and it takes an object, which a string is.

Henry
 
Greenhorn
Posts: 11
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

fred rosenberger wrote:There is an error...the above code won't compile.



You'll probably need the COM.objectspace.jgl package for that. I've tried to find it, but it seems that it's not freely available anymore.

 
Marshal
Posts: 76393
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That so‑called Array class appears to be a List. It has been enhanced with methods which count how many instances of a particular object it contains. You can probably create such a class yourself with a List implementation like ArrayList.
 
Good night. Drive safely. Here's a tiny ad for the road:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic