What is a natural return type in java?












5















I am reading Joshua Blochs "Effective Java", and it says




A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type. This gives you great flexibility in choosing the class of the returned object. One application of this flexibility is that an API can return objects without making their classes public. Hiding implementation classes in this fashion leads to a very compact API. This technique lends itself to interface-based frameworks, where interfaces provide natural return types for static factory methods.




Can anyone explain what "natural return types are"? Thanks!










share|improve this question


















  • 2





    I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

    – Sergei Sirik
    Jan 2 at 23:32


















5















I am reading Joshua Blochs "Effective Java", and it says




A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type. This gives you great flexibility in choosing the class of the returned object. One application of this flexibility is that an API can return objects without making their classes public. Hiding implementation classes in this fashion leads to a very compact API. This technique lends itself to interface-based frameworks, where interfaces provide natural return types for static factory methods.




Can anyone explain what "natural return types are"? Thanks!










share|improve this question


















  • 2





    I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

    – Sergei Sirik
    Jan 2 at 23:32
















5












5








5


1






I am reading Joshua Blochs "Effective Java", and it says




A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type. This gives you great flexibility in choosing the class of the returned object. One application of this flexibility is that an API can return objects without making their classes public. Hiding implementation classes in this fashion leads to a very compact API. This technique lends itself to interface-based frameworks, where interfaces provide natural return types for static factory methods.




Can anyone explain what "natural return types are"? Thanks!










share|improve this question














I am reading Joshua Blochs "Effective Java", and it says




A third advantage of static factory methods is that, unlike constructors, they can return an object of any subtype of their return type. This gives you great flexibility in choosing the class of the returned object. One application of this flexibility is that an API can return objects without making their classes public. Hiding implementation classes in this fashion leads to a very compact API. This technique lends itself to interface-based frameworks, where interfaces provide natural return types for static factory methods.




Can anyone explain what "natural return types are"? Thanks!







java return return-value factory






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 23:18









RonanRonan

383




383








  • 2





    I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

    – Sergei Sirik
    Jan 2 at 23:32
















  • 2





    I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

    – Sergei Sirik
    Jan 2 at 23:32










2




2





I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

– Sergei Sirik
Jan 2 at 23:32







I don't think it means anything specific to java features, syntax, or data types. This is not exactly about java at all, it is about interfaces. The synonym is probably "common", "more intuitive"...

– Sergei Sirik
Jan 2 at 23:32














3 Answers
3






active

oldest

votes


















2














In this context, "natural" simply means natural for the context of the factory method; i.e. what is appropriate or what you would expect. Intuitive would be another synonym.



This is just normal English usage ... not IT or Java-specific terminology.






share|improve this answer

































    2














    A concrete example of this would be something like Guava's ImmutableList factory methods.



    This has 13 overloads of the of method, with increasing numbers of parameters. If you look at the source of the first 3:



    @SuppressWarnings("unchecked")
    public static <E> ImmutableList<E> of() {
    return (ImmutableList<E>) EMPTY;
    }

    public static <E> ImmutableList<E> of(E element) {
    return new SingletonImmutableList<E>(element);
    }

    public static <E> ImmutableList<E> of(E e1, E e2) {
    return construct(e1, e2);
    }


    The zero-arg and two-arg methods actually return an instance of RegularImmutableList, which is a subclass of ImmutableList; the one-arg method returns an instance of SingletonImmutableList.



    But is this detail about the subclass relevant to you, the caller? No. It is "natural" that if you call a method that constructs an ImmutableList, you get back a reference to an ImmutableList.



    "Natural" in this sense perhaps means "at an appropriate level of abstraction".






    share|improve this answer































      1














      I think that it refers to the class of the factory (which is usually a static method in the class) which doesn't need to instantiate this specific class. However I don't think it is a defined or usually used term.



      Example: Term



      public abstract class Term {

      public abstract Integer evaluate();

      static Term literal(Integer number) {
      return new Literal(number);
      }

      static Term add(Term left, Term right) {
      return new Addition(left, right);
      }

      private static class Addition extends Term {
      private Term left;
      private Term right;

      public Addition(Term left, Term right) {
      this.left = left;
      this.right = right;
      }

      @java.lang.Override
      public Integer evaluate() {
      return left + right;
      }
      }

      private static class Literal extends Term {
      private Integer number;

      public Literal(Integer number) {
      this.number = number;
      }

      @java.lang.Override
      public Integer evaluate() {
      return number;
      }
      }
      }


      This is a class called Term with 2 factory methods: literal and add, which both return a Term but a subclass of it. Term itself is not instantable, because it is abstract. To the outer world the inner classes are not visible (they are private). Accessible is just the interface / abstract class Term, which is what is referred to in




      One application of this flexibility is that an API can return objects without making their classes public.




      I think the "natural class" to return here would be an Term and new is bound to return an instance of exactly the given type. A factory method can return subtypes.



      Example: Guava



      Guava is a library which provides additional collection classes for Java.
      One of these is an immutable list. It contains multiple factory methods for specific cases, for example one for an empty list and an additional one for lists which exactly one element.



      I don't think the term "natural class" is "official" though. Without the context (and even with it, as we can see here) it is not sure that it is recognized. So I took your question on a more broader scale and explained what the chapter is about.






      share|improve this answer


























      • "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

        – Stephen C
        Jan 3 at 0:57













      • The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

        – tilois
        Jan 3 at 1:31











      • The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

        – Stephen C
        Jan 3 at 1:41











      • I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

        – tilois
        Jan 3 at 1:58












      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014437%2fwhat-is-a-natural-return-type-in-java%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      In this context, "natural" simply means natural for the context of the factory method; i.e. what is appropriate or what you would expect. Intuitive would be another synonym.



      This is just normal English usage ... not IT or Java-specific terminology.






      share|improve this answer






























        2














        In this context, "natural" simply means natural for the context of the factory method; i.e. what is appropriate or what you would expect. Intuitive would be another synonym.



        This is just normal English usage ... not IT or Java-specific terminology.






        share|improve this answer




























          2












          2








          2







          In this context, "natural" simply means natural for the context of the factory method; i.e. what is appropriate or what you would expect. Intuitive would be another synonym.



          This is just normal English usage ... not IT or Java-specific terminology.






          share|improve this answer















          In this context, "natural" simply means natural for the context of the factory method; i.e. what is appropriate or what you would expect. Intuitive would be another synonym.



          This is just normal English usage ... not IT or Java-specific terminology.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          answered Jan 2 at 23:35


























          community wiki





          Stephen C


























              2














              A concrete example of this would be something like Guava's ImmutableList factory methods.



              This has 13 overloads of the of method, with increasing numbers of parameters. If you look at the source of the first 3:



              @SuppressWarnings("unchecked")
              public static <E> ImmutableList<E> of() {
              return (ImmutableList<E>) EMPTY;
              }

              public static <E> ImmutableList<E> of(E element) {
              return new SingletonImmutableList<E>(element);
              }

              public static <E> ImmutableList<E> of(E e1, E e2) {
              return construct(e1, e2);
              }


              The zero-arg and two-arg methods actually return an instance of RegularImmutableList, which is a subclass of ImmutableList; the one-arg method returns an instance of SingletonImmutableList.



              But is this detail about the subclass relevant to you, the caller? No. It is "natural" that if you call a method that constructs an ImmutableList, you get back a reference to an ImmutableList.



              "Natural" in this sense perhaps means "at an appropriate level of abstraction".






              share|improve this answer




























                2














                A concrete example of this would be something like Guava's ImmutableList factory methods.



                This has 13 overloads of the of method, with increasing numbers of parameters. If you look at the source of the first 3:



                @SuppressWarnings("unchecked")
                public static <E> ImmutableList<E> of() {
                return (ImmutableList<E>) EMPTY;
                }

                public static <E> ImmutableList<E> of(E element) {
                return new SingletonImmutableList<E>(element);
                }

                public static <E> ImmutableList<E> of(E e1, E e2) {
                return construct(e1, e2);
                }


                The zero-arg and two-arg methods actually return an instance of RegularImmutableList, which is a subclass of ImmutableList; the one-arg method returns an instance of SingletonImmutableList.



                But is this detail about the subclass relevant to you, the caller? No. It is "natural" that if you call a method that constructs an ImmutableList, you get back a reference to an ImmutableList.



                "Natural" in this sense perhaps means "at an appropriate level of abstraction".






                share|improve this answer


























                  2












                  2








                  2







                  A concrete example of this would be something like Guava's ImmutableList factory methods.



                  This has 13 overloads of the of method, with increasing numbers of parameters. If you look at the source of the first 3:



                  @SuppressWarnings("unchecked")
                  public static <E> ImmutableList<E> of() {
                  return (ImmutableList<E>) EMPTY;
                  }

                  public static <E> ImmutableList<E> of(E element) {
                  return new SingletonImmutableList<E>(element);
                  }

                  public static <E> ImmutableList<E> of(E e1, E e2) {
                  return construct(e1, e2);
                  }


                  The zero-arg and two-arg methods actually return an instance of RegularImmutableList, which is a subclass of ImmutableList; the one-arg method returns an instance of SingletonImmutableList.



                  But is this detail about the subclass relevant to you, the caller? No. It is "natural" that if you call a method that constructs an ImmutableList, you get back a reference to an ImmutableList.



                  "Natural" in this sense perhaps means "at an appropriate level of abstraction".






                  share|improve this answer













                  A concrete example of this would be something like Guava's ImmutableList factory methods.



                  This has 13 overloads of the of method, with increasing numbers of parameters. If you look at the source of the first 3:



                  @SuppressWarnings("unchecked")
                  public static <E> ImmutableList<E> of() {
                  return (ImmutableList<E>) EMPTY;
                  }

                  public static <E> ImmutableList<E> of(E element) {
                  return new SingletonImmutableList<E>(element);
                  }

                  public static <E> ImmutableList<E> of(E e1, E e2) {
                  return construct(e1, e2);
                  }


                  The zero-arg and two-arg methods actually return an instance of RegularImmutableList, which is a subclass of ImmutableList; the one-arg method returns an instance of SingletonImmutableList.



                  But is this detail about the subclass relevant to you, the caller? No. It is "natural" that if you call a method that constructs an ImmutableList, you get back a reference to an ImmutableList.



                  "Natural" in this sense perhaps means "at an appropriate level of abstraction".







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 3 at 0:16









                  Andy TurnerAndy Turner

                  84.2k983143




                  84.2k983143























                      1














                      I think that it refers to the class of the factory (which is usually a static method in the class) which doesn't need to instantiate this specific class. However I don't think it is a defined or usually used term.



                      Example: Term



                      public abstract class Term {

                      public abstract Integer evaluate();

                      static Term literal(Integer number) {
                      return new Literal(number);
                      }

                      static Term add(Term left, Term right) {
                      return new Addition(left, right);
                      }

                      private static class Addition extends Term {
                      private Term left;
                      private Term right;

                      public Addition(Term left, Term right) {
                      this.left = left;
                      this.right = right;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return left + right;
                      }
                      }

                      private static class Literal extends Term {
                      private Integer number;

                      public Literal(Integer number) {
                      this.number = number;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return number;
                      }
                      }
                      }


                      This is a class called Term with 2 factory methods: literal and add, which both return a Term but a subclass of it. Term itself is not instantable, because it is abstract. To the outer world the inner classes are not visible (they are private). Accessible is just the interface / abstract class Term, which is what is referred to in




                      One application of this flexibility is that an API can return objects without making their classes public.




                      I think the "natural class" to return here would be an Term and new is bound to return an instance of exactly the given type. A factory method can return subtypes.



                      Example: Guava



                      Guava is a library which provides additional collection classes for Java.
                      One of these is an immutable list. It contains multiple factory methods for specific cases, for example one for an empty list and an additional one for lists which exactly one element.



                      I don't think the term "natural class" is "official" though. Without the context (and even with it, as we can see here) it is not sure that it is recognized. So I took your question on a more broader scale and explained what the chapter is about.






                      share|improve this answer


























                      • "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                        – Stephen C
                        Jan 3 at 0:57













                      • The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                        – tilois
                        Jan 3 at 1:31











                      • The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                        – Stephen C
                        Jan 3 at 1:41











                      • I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                        – tilois
                        Jan 3 at 1:58
















                      1














                      I think that it refers to the class of the factory (which is usually a static method in the class) which doesn't need to instantiate this specific class. However I don't think it is a defined or usually used term.



                      Example: Term



                      public abstract class Term {

                      public abstract Integer evaluate();

                      static Term literal(Integer number) {
                      return new Literal(number);
                      }

                      static Term add(Term left, Term right) {
                      return new Addition(left, right);
                      }

                      private static class Addition extends Term {
                      private Term left;
                      private Term right;

                      public Addition(Term left, Term right) {
                      this.left = left;
                      this.right = right;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return left + right;
                      }
                      }

                      private static class Literal extends Term {
                      private Integer number;

                      public Literal(Integer number) {
                      this.number = number;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return number;
                      }
                      }
                      }


                      This is a class called Term with 2 factory methods: literal and add, which both return a Term but a subclass of it. Term itself is not instantable, because it is abstract. To the outer world the inner classes are not visible (they are private). Accessible is just the interface / abstract class Term, which is what is referred to in




                      One application of this flexibility is that an API can return objects without making their classes public.




                      I think the "natural class" to return here would be an Term and new is bound to return an instance of exactly the given type. A factory method can return subtypes.



                      Example: Guava



                      Guava is a library which provides additional collection classes for Java.
                      One of these is an immutable list. It contains multiple factory methods for specific cases, for example one for an empty list and an additional one for lists which exactly one element.



                      I don't think the term "natural class" is "official" though. Without the context (and even with it, as we can see here) it is not sure that it is recognized. So I took your question on a more broader scale and explained what the chapter is about.






                      share|improve this answer


























                      • "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                        – Stephen C
                        Jan 3 at 0:57













                      • The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                        – tilois
                        Jan 3 at 1:31











                      • The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                        – Stephen C
                        Jan 3 at 1:41











                      • I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                        – tilois
                        Jan 3 at 1:58














                      1












                      1








                      1







                      I think that it refers to the class of the factory (which is usually a static method in the class) which doesn't need to instantiate this specific class. However I don't think it is a defined or usually used term.



                      Example: Term



                      public abstract class Term {

                      public abstract Integer evaluate();

                      static Term literal(Integer number) {
                      return new Literal(number);
                      }

                      static Term add(Term left, Term right) {
                      return new Addition(left, right);
                      }

                      private static class Addition extends Term {
                      private Term left;
                      private Term right;

                      public Addition(Term left, Term right) {
                      this.left = left;
                      this.right = right;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return left + right;
                      }
                      }

                      private static class Literal extends Term {
                      private Integer number;

                      public Literal(Integer number) {
                      this.number = number;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return number;
                      }
                      }
                      }


                      This is a class called Term with 2 factory methods: literal and add, which both return a Term but a subclass of it. Term itself is not instantable, because it is abstract. To the outer world the inner classes are not visible (they are private). Accessible is just the interface / abstract class Term, which is what is referred to in




                      One application of this flexibility is that an API can return objects without making their classes public.




                      I think the "natural class" to return here would be an Term and new is bound to return an instance of exactly the given type. A factory method can return subtypes.



                      Example: Guava



                      Guava is a library which provides additional collection classes for Java.
                      One of these is an immutable list. It contains multiple factory methods for specific cases, for example one for an empty list and an additional one for lists which exactly one element.



                      I don't think the term "natural class" is "official" though. Without the context (and even with it, as we can see here) it is not sure that it is recognized. So I took your question on a more broader scale and explained what the chapter is about.






                      share|improve this answer















                      I think that it refers to the class of the factory (which is usually a static method in the class) which doesn't need to instantiate this specific class. However I don't think it is a defined or usually used term.



                      Example: Term



                      public abstract class Term {

                      public abstract Integer evaluate();

                      static Term literal(Integer number) {
                      return new Literal(number);
                      }

                      static Term add(Term left, Term right) {
                      return new Addition(left, right);
                      }

                      private static class Addition extends Term {
                      private Term left;
                      private Term right;

                      public Addition(Term left, Term right) {
                      this.left = left;
                      this.right = right;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return left + right;
                      }
                      }

                      private static class Literal extends Term {
                      private Integer number;

                      public Literal(Integer number) {
                      this.number = number;
                      }

                      @java.lang.Override
                      public Integer evaluate() {
                      return number;
                      }
                      }
                      }


                      This is a class called Term with 2 factory methods: literal and add, which both return a Term but a subclass of it. Term itself is not instantable, because it is abstract. To the outer world the inner classes are not visible (they are private). Accessible is just the interface / abstract class Term, which is what is referred to in




                      One application of this flexibility is that an API can return objects without making their classes public.




                      I think the "natural class" to return here would be an Term and new is bound to return an instance of exactly the given type. A factory method can return subtypes.



                      Example: Guava



                      Guava is a library which provides additional collection classes for Java.
                      One of these is an immutable list. It contains multiple factory methods for specific cases, for example one for an empty list and an additional one for lists which exactly one element.



                      I don't think the term "natural class" is "official" though. Without the context (and even with it, as we can see here) it is not sure that it is recognized. So I took your question on a more broader scale and explained what the chapter is about.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 3 at 1:53

























                      answered Jan 3 at 0:14









                      tiloistilois

                      575312




                      575312













                      • "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                        – Stephen C
                        Jan 3 at 0:57













                      • The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                        – tilois
                        Jan 3 at 1:31











                      • The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                        – Stephen C
                        Jan 3 at 1:41











                      • I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                        – tilois
                        Jan 3 at 1:58



















                      • "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                        – Stephen C
                        Jan 3 at 0:57













                      • The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                        – tilois
                        Jan 3 at 1:31











                      • The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                        – Stephen C
                        Jan 3 at 1:41











                      • I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                        – tilois
                        Jan 3 at 1:58

















                      "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                      – Stephen C
                      Jan 3 at 0:57







                      "I don't think the term "natural class" is "official" though." - precisely! In my 20+ years of Java programming / spec reading, etc, I don't recall ever seeing the phrase "natural class" used as terminology. Which is why I reckon that Bloch is just using "natural" as a normal English word. As one would do ... naturally.

                      – Stephen C
                      Jan 3 at 0:57















                      The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                      – tilois
                      Jan 3 at 1:31





                      The question about answering questions is: What do you read from the question and what do you answer. If you take the question literally: There is no "natural class" to the best of my / our knowledge. However there is meaning to the book chapter. I decided to answer that, instead of the literal question. Beeing able to phrase a question correctly is often already part of the answer :)

                      – tilois
                      Jan 3 at 1:31













                      The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                      – Stephen C
                      Jan 3 at 1:41





                      The first sentence says - "I disagree that it is "just english language". I am rebutting that. Since this is not recognized terminology (official or otherwise) it must be just English. Obviously, the author has a meaning in mind when he uses those words ... but he is not trying to use or invent terminology here. But your answer is saying that this is terminology ... without any supporting evidence. (Your supposed evidence is actually argumentation, and 100% consistent with the normal English use / sense of the word "natural".)

                      – Stephen C
                      Jan 3 at 1:41













                      I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                      – tilois
                      Jan 3 at 1:58





                      I rephrased that sentence. I still think he refers to the specific class of the static factory method. I do see your point though. I don't disagree on that whether the term is defined (I also don't think so). I interpreted "just english" in the sense that it doesn't refer to an programming term, which I think it does.

                      – tilois
                      Jan 3 at 1:58


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014437%2fwhat-is-a-natural-return-type-in-java%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                      Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                      A Topological Invariant for $pi_3(U(n))$