Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2018, 03:21 PM
Registered User
 
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
 
Old June 4th, 2018, 02:58 AM
Registered User
 
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)
}





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 07:35 AM
Object doesn't support this property or method ASP crmpicco Classic ASP Components 0 March 16th, 2006 01:26 PM
Property/Method access using string values jaucourt VB.NET 2002/2003 Basics 1 February 10th, 2004 01:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.