Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 2nd, 2018, 03:21 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2018
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Question on converting a method into a property

I've written the following method - it's Groovy/Java based:

I've been asked to convert this method into a property...
can anyone give me some tips on how to do this... I am new
to classes and object-oriented programming:

Code:
 boolean sortedDescending(columnId) {
        def doubleFormat = NumberFormat.instance
        def originalList = txnTable.column(columnId).collect { it.text() }
        def descendingSortedList = originalList.sort(false) { it ?   
              -doubleFormat.parse(it) : Double.POSITIVE_INFINITY }
        return (descendingSortedList == originalList)
}
Thanks so much... Rich
Reply With Quote
  #2 (permalink)  
Old June 4th, 2018, 02:58 AM
Registered User
Points: 15, Level: 1
Points: 15, Level: 1 Points: 15, Level: 1 Points: 15, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2018
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
boolean sortedDescending(columnId) {
def doubleFormat = NumberFormat.instance
def originalList = txnTable.column(columnId).collect { it.text() }
def descendingSortedList = originalList.sort(false) { it ? -doubleFormat.parse(it) : Double.POSITIVE_INFINITY }
return (descendingSortedList == originalList)
}
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
index method or property sw_gshort BOOK: Professional JavaScript for Web Developers 3rd edition 0 September 23rd, 2014 08:45 PM
Object Doesn't support property or method ayazhoda Access VBA 2 November 16th, 2009 06:35 AM
Object doesn't support this property or method ASP crmpicco Classic ASP Components 0 March 16th, 2006 12:26 PM
Property/Method access using string values jaucourt VB.NET 2002/2003 Basics 1 February 10th, 2004 12:05 PM



All times are GMT -4. The time now is 06:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.