Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8645597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:35:27+00:00 2026-06-12T12:35:27+00:00

I’m trying to sort a Documents Collection using a java.util.ArrayList. var myarraylist:java.util.ArrayList = new

  • 0

I’m trying to sort a Documents Collection using a java.util.ArrayList.

var myarraylist:java.util.ArrayList = new java.util.ArrayList()
var doc:NotesDocument = docs.getFirstDocument();

while (doc != null) {       
    myarraylist.add(doc)                       
    doc = docs.getNextDocument(doc);        
}

The reason I’m trying with ArrayList and not with TreeMaps or HashMaps is because the field I need for sorting is not unique; which is a limitation for those two objects (I can’t create my own key).

The problem I’m facing is calling CustomComparator:

Here how I’m trying to sort my arraylist:

java.util.Collections.sort(myarraylist, new CustomComparator());

Here my class:

import java.util.Comparator;
import lotus.notes.NotesException;

public class CustomComparator implements Comparator<lotus.notes.Document>{


public int compare(lotus.notes.Document doc1, lotus.notes.Document doc2) {
    try {
        System.out.println("Here");
        System.out.println(doc1.getItemValueString("Form"));             
         return doc1.getItemValueString("Ranking").compareTo(doc2.getItemValueString("Ranking"));
    } catch (NotesException e) {
        e.printStackTrace();
    }
    return 0;
}

}

Error:

Script interpreter error, line=44, col=23: Error calling method
‘sort(java.util.ArrayList, com.myjavacode.CustomComparator)’ on java
class ‘java.util.Collections’

Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:35:28+00:00Added an answer on June 12, 2026 at 12:35 pm

    I tried to run your SSJS code in a try-catch block, printing the error in exception in catch block and I got the following message – java.lang.ClassCastException: lotus.domino.local.Document incompatible with lotus.notes.Document

    I think you have got incorrect fully qualified class names of Document and NotesException. They should be lotus.domino.Document and lotus.domino.NotesException respectively.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.