View Single Post
  #7   Spotlight this post!  
Unread 07-02-2017, 14:01
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 756
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: Sort array in filterContours

Quote:
Originally Posted by SamCarlberg View Post
That's called a method reference.

This article explains it quite well

Also, you don't even need a special method for sorting a list. The List interface defines a method "sort(Comparator)" that you can use inline like

Code:
contours.sort(Comparator.comparingDouble(Imgproc::contourArea));
Dang... As an "vintage" programmer, it's sometimes scary when I realize how much I don't know about the "newer" languages. That's pretty darn powerful.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor
Reply With Quote