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

  • SEARCH
  • Home
  • 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 8976935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:15:35+00:00 2026-06-15T19:15:35+00:00

Given the following code snippet that fetches records from a Cassandra database : QueryResult<OrderedRows<String,

  • 0

Given the following code snippet that fetches records from a Cassandra database :

QueryResult<OrderedRows<String, String, String>> result = rangeSlicesQuery.execute();
OrderedRows<String, String, String> rows = result.get();
Iterator<Row<String, String, String>> rowsIterator = rows.iterator();

If I put the rowsIterator object on a Queue defined as :

BlockingQueue<Iterator<Row<String, String, String>>> queue = 
    new PriorityBlockingQueue<Iterator<Row<String, String, String>>>();

Now, if I have a thread that reads from this queue, will I be able to fetch the iterator from the queue and iterate over the OrderRows in this thread?

In other words, can iterators created in one thread be passed to a second thread such that the second thread can iterate over the original collection for which the iterator was created in the first thread?

  • 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-15T19:15:36+00:00Added an answer on June 15, 2026 at 7:15 pm

    Briefly, yes. It’s just an object referencing your collection.

    I would perhaps be wary of this. Having an iterator used in one thread presumably means that you can modify your collection in the other thread, and you run the risk of concurrent modifications unless you’re careful. Perhaps iterate over a copy of your original collection ?

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

Sidebar

Related Questions

Given the following code snippet from Anthony Williams . A very basic tuple example
Given the following code snippet from inside a method; NSBezierPath * tempPath = [NSBezierPath
Given the following code snippet: $i= 11; function get_num() { global $i; return (--$i
Given the following code below, how can I have it modified such that it
Given the following code: string source = Some Unicode String; foreach( char value in
Environment: VS2005 C++ using STLPort 5.1.4. Compiling the following code snippet: std::string copied =
following snippet is from rails code def rescue_from(*klasses, &block) options = klasses.extract_options! unless options.has_key?(:with)
Question: Given the following code snippet: bool foo(int n) { for(int i=3;i<sqrt(n)+0.5;i+=2) { if((n%i)==0){
Given that the following snippet doesn't compile: std::stringstream ss; ss << std::wstring(Labc); I didn't
In the following code snippet, are there any caveats that need to be considered?

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.