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 7959155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:31:42+00:00 2026-06-04T04:31:42+00:00

The complete() method in the Calendar class performs the following operations: protected void complete()

  • 0

The complete() method in the Calendar class performs the following operations:

protected void complete()

Fills in any unset fields in the calendar fields. First, the
computeTime() method is called if the time value (millisecond offset
from the Epoch) has not been calculated from calendar field values.
Then, the computeFields() method is called to calculate all calendar
field values.

the complete() method has the following code:

protected void complete()
    {
        if (!isTimeSet)
        updateTime();
        if (!areFieldsSet || !areAllFieldsSet) {
            computeFields(); // fills in unset fields
            areAllFieldsSet = areFieldsSet = true;
        }
    }

My question is what is the point of this circular work?? First values from

protected int[] fields

are used to update the value of

long time 

using the computeTime() method. And then the value of time is used to update values in fields using computeFields(). The value in both time and fields will be in sync after the call to computeTime() itself, right?? or am i missing something here??

For those who might ask why is it so important, well it is because the order in which the time is recomputed in Calendar often changes the time we get from getTime() (or so i have read)!!

  • 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-04T04:31:43+00:00Added an answer on June 4, 2026 at 4:31 am

    It’s not circular.

    Imagine you have a Calendar object with some, but not all, fields set. This method will (a) compute and save the epoch (long time) from the fields that are set, then (b) set all the unset fields to be consistent with the epoch it just computed.

    So when the method completes you’ll have a Calendar with all fields filled in and consistent. That is a different, better state of the object from where you started.

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

Sidebar

Related Questions

I am trying to override NSTextView - (void)complete:(id)sender method but I can't find any
The Scanner class provides a convenient method to skip over whitespace and get complete
I'm tring to find out a way to get the complete method signature that
I'm new to ARC. I want to call a method in a complete block,
I am using form_tag <%= form_tag url_for(:action=>'url'), :onclick=> $('.submit_btn').addClass('disabled');, :complete=>$(.submit_btn).removeClass(disabled), :method=>post, :remote =>true do
The TransactionScope expects a call to its Complete method as follows. Otherwise the transaction
The LoadIt() method below takes 5-10 seconds to complete. I want the message area
Is there hotkey which can let me auto complete method name in Eclipse?
In a school assignment I'm supposed to complete a method that should return an
A feature in Eclipse that I really miss is how you can auto-complete method

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.