mobile – Should I buy an Expo ( with 2020 Expo SDK 39) or React Native CLI classes?

Good night, everyone…
I`ve been studying react native for about 1 year, and always used expo sdk 37. I managed to develop 2 different apps, but I only knew about “how to do it” and not ” how does it work”.

I can say I have intermediate level at this coding, and I`m looking for some online paid classes.

My doubt is:
I can’t find any classes that actually uses Expo during the teaching, and I heard many videos about how new EXPO SDK is incredible… So is it worth it to study and develop projects with React-native-cli or should I just keep geting better at expo?

Also,if you can truly explain me the advantages and disadvantages of using expo, feel free to do it

dnd 5e – How much does this Favored Foe tweak for the Ranger’s class feature from TCoE buffs the Rangers when compared to other martial classes?

I want to tweak the Favored Foe optional class feature for the Ranger from Tasha’s Cauldron of Everything

I’m fairly disappointed with the Favored Foe optional class feature for the Rangers released in TCoE, it’s essentially just a worse Hunter’s Mark. This feature allows more versatility with your Foe Slayer feature at level 20, but it also locks your concentration. Since it’s a worse Hunter’s Mark, Favored Foe will probably see less use until you get Foe Slayer (and how many games reach level 20?). The only saving grace to this feature is the improved action economy. Two weapon fighting or crossbow expert Rangers might see some use out of this.

While the UA version is definitely better in terms of damage, I’d have to agree with this Reddit post that says that the UA version incentivizes 1 level dip to the Ranger class, but doesn’t incentivize more levels in Ranger. User u/ZatherDaFox added “One of the ranger’s biggest issues has always been a lack of really cool mid and late game abilities to justify taking the class that high.

Now, I’m trying to come up with a solution after Favored Foe was officially published in Tasha’s Caudron of Everything. tl;dr, here’s the changelog:

  • Renamed it to Hunter’s Mark
  • If you take this optional class feature, it replaces your Favored Enemy class feature and removes the Hunter’s Mark spell from this Ranger’s spell list
  • The damage still scales exactly the same as TCoE’s Favored Foe, but now it applies to every attack that hits (even spell attacks)
  • Added the advantage to track and find it bit from the Hunter’s Mark spell
  • Duration is 1 hour, following the Hunter’s Mark spell
  • Number of uses equal to proficiency bonus per short or long rest
  • At level 11, it no longer requires concentration

Hunter’s Mark

1st-level ranger feature, which replaces the Favored Enemy feature and works with the Foe Slayer feature. Furthermore, Hunter’s Mark is removed from your spell list.

When you hit a creature with an attack roll, you can call on your mystical bond with nature to mark the target as your favored enemy for 1 hour or until you lose your concentration (as if you were concentrating on a spell). Until your concentration ends, you deal an extra 1d4 damage to the target whenever you hit it with an attack, and you have advantage on any Wisdom (Perception) or Wisdom (Survival) check you make to find it.
    You can use this feature to mark a favored enemy a number of times equal to your proficiency bonus, and you regain all expended uses when you finish a short or long rest. This feature’s extra damage increases when you reach certain levels in this class: to 1d6 at 6th level and to 1d8 at 14th level. Furthermore, once you have reached 11th level in this class, this feature no longer requires concentration.

What this aims to fix:

As stated before, I want people to want to play the Ranger class and experience them at higher levels, not just as one level dips. I play a Ranger in my homebrew campaign, but I use the Revised Ranger UA version because the PHB just seems very DM-/campaign-dependent and, to me at least, is poorly designed compared to the other classes. Tasha’s has introduced a lot of new optional class features for the Ranger that I’m eternally grateful for (I’ll literally never take the PHB Natural Explorer ever again). So it sucks to see that one of them just barely misses the mark (get it? Hahah).

The changes doesn’t really alter the playstyle of the Ranger prior to level 11, I think. Every Rangers still need to contemplate the usual “do I drop my Hunter’s Mark now and try something different, or should I stick with it?” This has always been a problem with me in my campaign, and in its current state I do plan on multiclassing into Rogue very soon, since I don’t think I can utilize many spells because my Wisdom is not that high. I know that sounds more like a me thing but Wisdom is not generally the Ranger’s main ability score either, so it’s usually lower than their Dexterity, de-incentivizing creative uses of spells with a saving throw or a to-hit. Also I’d like to add that I set the uses at PB per short or long rest since this Hunter’s Mark can’t jump between targets when you reduce one to 0 hit points.

This changes in level 11, though. This Ranger’s Hunter’s Mark now no longer requires concentration. I read somewhere (can’t find it anymore) that advised people who wants to homebrew stuff to stay away from altering the concentration mechanic in D&D 5e, among other things (action economy was also mentioned). I removed the concentration at level 11 because it’s entering a new tier of play, so I think it’s a fitting jump in terms of prowess for this class. Also, since it no longer requires concentration at this level, Rangers can now try more experiments with their spells! It removes one decision point in combat for the Ranger, which I think is a good thing.

The Ranger’s current level 11 class feature is tied to their subclass, so this adds another oomph to those as well. But, I am also deathly afraid that messing with concentration like this is going to overpower the Ranger when compared to the other martial classes. My biggest argument is that the Paladin gets Improved Divine Smite also at 11th level, which is very similar to this Hunter’s Mark since it a straight damage buff.

tl;dr, the question: do these changes for Favored Foe, now renamed Hunter’s Mark, significantly buffs the Rangers, to the point of overpowered when compared to the other martial classes?

classes – Class in python modifies several objects instead of just one

I have written the following piece of code (which is actually a toy example for a more complex application I have).

We have the class Points, which are basically two lists of equal length containing x et y coordinates of points. We can add a point to a Points object with the add_point method.

Then we have the LayersOfPoints class, which represents several numbered layers of Points. We can add a point to a specific layer with the add_layer_point method.

class Points:
    def __init__(self,x_coordinates=(),y_coordinates=()):
        if len(x_coordinates)!=len(y_coordinates) : raise ValueError("Each should have both a x and a y coordinate")
        self.x_coordinates= x_coordinates
        self.y_coordinates= y_coordinates

    def add_point(self,x_coordinate,y_coordinate):
        self.x_coordinates.append(x_coordinate)
        self.y_coordinates.append(y_coordinate)

class LayersOfPoints:
    def __init__(self,number_of_layers):
        self.number_of_layers= number_of_layers
        self.layers = (Points() for l in range(number_of_layers))
               
    def add_layer_point(self,layer,x_coordinate,y_coordinate):
        self.layers(layer-1).add_point(x_coordinate,y_coordinate)

layer_of_points = LayersOfPoints(2)
layer_of_points.add_layer_point(1,12,15)
layer_of_points.add_layer_point(2,9,5)

print(layer_of_points.layers(0).x_coordinates,layer_of_points.layers(0).y_coordinates)
print(layer_of_points.layers(1).x_coordinates,layer_of_points.layers(0).y_coordinates)

It returns

(12, 9) (15, 5)
(12, 9) (15, 5)

While to me it should return

(12) (15)
(9) (5)

java – Naming conventions for classes that technically could/should have the same name

Sometimes such classes would be named as Base- or Core- to indicate that they are to be extended in other implementations, so you’d have CoreBoard and CorePiece.

Depending on the language you’re using, you could also use namespaces to distinguish between the two sets of classes. You could have a namespace for the Engine, and other namespaces for specific implementations. For example: jaylawl.games.engine.Board for the Engine’s Board, and jaylawl.games.chess.Board for your Chess board.

Personally, I prefer the second option, but that may be language-specific.

dnd 5e – Is there a resource anywhere that lists every spell and the classes that can use them?

There are now a number of resources that provide lists of spells, the PHB, Tashas Cauldron, XGTE etc. As well as spells that are included in specific adventure or campaign books.

There are also new classes that come with new spell rules, artificer is one.

Is there a single resource anywhere that lists all the spells currently published for 5th edition, the classes they can be used by and the level? I am not looking for the spell rules just an updated list as per the PHB that includes every published spell by class.

Or a list that lists out every spell and the classes that can use them.

plugin development – Additional classes `undefined` after saving post in Gutenberg

The problem: whenever I type something in Advanced->Addition Classes in Gutenberg editor and save the page/post and refresh, those classes disappear. I logged props.className in edit function. It logs the value as expected when I type the class name in the Advanced->Addition Classes field. The problem occurs when I save the post after inputting the class name and refresh the page. I followed the exact same method in other blocks I created and they work just fine.

The Code:

        const {attributes, setAttributes} = props;
        const headingBgOverlay = Util.getBgOverlay(attributes, 'heading');
        const bodyBgOverlay = Util.getBgOverlay(attributes, 'body');

        useEffect(() => {
            setAttributes({blockId: Util.guidGenerator()});
        }, ());

        useEffect(() => {
            console.log(props)
            console.log(props.className)
            console.log(attributes.className)
            setAttributes({headingBgOverlay});
            setAttributes({bodyBgOverlay});
        }, (attributes));
        return (
            <Fragment>
                <Fragment>
                    <style>
                        {listIconCss(attributes)}
                    </style>
                    <div className={"atbs atbs-pricing-table " + props.className}
                         id={'atbs-pricing-table-' + attributes.blockId}>
                        <div className="plan"
                             style={{...planCss(attributes)}}>
                            <div className="head" style={{...titleCss(attributes)}}>
                                <RichText style={{...titleTypographyCss(attributes)}} tagName="h2" className={'m-0'}
                                          value={attributes.title}
                                          onChange={(title) => setAttributes({title})}
                                          placeholder={__('Plan name', 'attire-blocks')}/>
                            </div>
                            <div className='atbs_pricing_table_body'>
                                <RichText
                                    style={{...descrCss(attributes)}}
                                    className={'description'} tagName="p" value={attributes.description}
                                    onChange={(description) => setAttributes({description})}
                                    placeholder={__('Description...', 'attire-blocks')}/>
                                <div className="price" style={{...priceCss(attributes)}}>
                                    <RichText style={{fontSize: (attributes.priceFontSize / 2) + 'px'}}
                                              className={'symbol'}
                                              tagName="span" value={attributes.symbol}
                                              onChange={(symbol) => setAttributes({symbol})}
                                              placeholder={__('$')}/>
                                    <RichText className={'amount'}
                                              tagName="span" value={attributes.price}
                                              onChange={(price) => setAttributes({price})}
                                              placeholder={__('99.99')}/>

                                    {attributes.recurring && <RichText
                                        style={{fontSize: `${attributes.descrFontSize}${attributes.descrFontSizeUnit}`}}
                                        tagName="span" value={attributes.recurringTime}
                                        className="recurring"
                                        onChange={(value) => setAttributes({recurringTime: value})}
                                        placeholder={__('/month', 'attire-blocks')}/>}

                                </div>
                                {attributes.showFeatures && <RichText
                                    style={{...listCss(attributes)}}
                                    multiline="li"
                                    tagName="ul"
                                    className="features"
                                    onChange={(nextValues) => setAttributes({features: nextValues})}
                                    value={attributes.features}
                                    placeholder={__('Write list…', 'attire-blocks')}
                                />}

                                <InnerBlocks allowedBlocks={('attire-blocks/buttons')}
                                             template={(('attire-blocks/buttons', {
                                                 buttonAlignment: 'center'
                                             }))}
                                             templateLock="all"/>
                            </div>
                        </div>
                    </div>
                </Fragment>
            </Fragment>
        );
    },
    save: ({attributes, className}) => {
        //const {attributes} = props;
        return (
            <Fragment>
                <style>
                    {listIconCss(attributes)}
                </style>
                <div className={"atbs atbs-pricing-table " + className}
                     id={'atbs-pricing-table-' + attributes.blockId}>
                    <div className="plan"
                         style={{...planCss(attributes)}}>
                        {attributes.title &&
                        <div className="head" style={{...titleCss(attributes)}}>
                            <RichText.Content style={{...titleTypographyCss(attributes)}} tagName="h2" className={'m-0'}
                                              value={attributes.title}/>
                        </div>}
                        <div className='atbs_pricing_table_body'>
                            {attributes.description &&
                            <RichText.Content
                                style={{...descrCss(attributes)}}
                                className={'description'} tagName="p" value={attributes.description}/>}
                            <div className="price" style={{...priceCss(attributes)}}>
                                <RichText.Content style={{fontSize: (attributes.priceFontSize / 2) + 'px'}}
                                                  className={'symbol'} tagName="span" value={attributes.symbol}/>
                                <RichText.Content
                                    style={{
                                        color: attributes.bodyTextColor,
                                        fontSize: (attributes.priceFontSize) + 'px'
                                    }}
                                    className={'amount'}
                                    tagName="span" value={attributes.price}/>
                                {attributes.recurring && <RichText.Content
                                    style={{fontSize: `${attributes.descrFontSize}${attributes.descrFontSizeUnit}`}}
                                    className="recurring"
                                    tagName="span" value={attributes.recurringTime}/>}
                            </div>
                        </div>
                        {attributes.showFeatures && <RichText.Content
                            style={{...listCss(attributes)}}
                            className={'features'}
                            tagName="ul" value={attributes.features}/>}
                        <InnerBlocks.Content/>
                    </div>
                </div>
            </Fragment>
        );
    }
});```

java – can inner classes access the outer class variables/methods if they have same name?

I am trying to access outer class variables from inner class when inner class also has variables with same name and type, How to access name variable of class A from class B show method?

 class A {
    
        String name;
        int marks;
    
        // Member inner class
        class B {
            String name;
            
            public void show() {
                System.out.println(this.name + " " + A.name + " " + marks);
            }
        }
    
        public void show() {
            System.out.println("in a show");
        }
    
    }

balance – Power levels of RIFTS classes

When I play or GM Rifts there are a few things that I need to know. The first is whether the group wants to play a combat, social, or mixed game. The second is whether the group wants a high powered or low powered campaign. From the nature of your question I believe you wish to know how to rank characters in a high powered combat campaign on Rifts Earth which in my experience is the easiest style to rank them.

First thing to know is there are many aspects to combat. Because combat rounds last 15 seconds and many actions happen in that time some kinds of attacks will be much more effective then strait damage. Stunning attacks tend to be more effective at removing enemies from combat sense they tend to last a number of rounds, and any attack that knocks a character down will cost them an action. A stun can be more than enough time for an automatic hit on a called shot to the head in melee/point blank range. Like most game systems defensive capability and offensive capability have to be balanced out. To help with this my group breaks the characters down into three broad categories before ranking them Artillery, Heavy, and Light. I will first explain these categories, then I will give examples of some group tactics, and then I will give a numbered list of character classes by power.

Artillery is any character whose main/preferred combat option is to hang back and pepper the enemy from relative safety. Because of the safety element, this is the default position for non-combat utility characters (buffing/repairing/talking characters). Giant Robots using missiles, invisible/shielded/hidden Mages using ritual magic or summoned creatures, and snipers using stealth and confusion are all examples of Artillery characters. The jobs of this character are to deal as much damage as possible, watch for enemy reinforcement, apply debilitating effects to the enemy, and provide a “safe” fallback position. Giant robots and sometimes Glitter Boys fall into this category because they are expensive to repair and have excellent long range damage. Shifters and similar mages fall into this category because they have low average MDC (35-100) and spells that can totally change the nature of a battle, examples being Summon and Control Entity, Firequake, and Carpet of Adhesion.

A Heavy character is a tank and is expected to deal out solid damage while taking the majority of the enemy’s fire. The two most important aspects of this position are staying power and fire power. Combat Cyborgs with detachable heavy cyborg armor plating, power armor pilots with either good armor or flight capable, Baby Dragons with their MDC bio-regeneration, and Glitter Boys who have invested in a giant MDC shield are all examples of Heavy characters. The jobs of these characters is to be a solid and significant threat to the enemy, and draw enemy attention away from Light and Artillery characters. Power Armor and Cyborgs fall into this because they have solid armor (500-1000), good mobility, and can wield rail guns and other heavy MDC weapons. Baby Dragons and other high MDC creatures are this because they can tank damage without any cost sense it only takes a few minutes for them to completely heal from their wounds. If a Glitter Boy can regularly afford the costs of repairing damage he should be here because he represents a threat the enemy cannot ignore and will draw their attacks. Some creatures that have been summoned by mages will want to act as heavies sense they represent free MDC to the party.

A Light character is anyone who is acting as a normal soldier whether looking to get in close or take cover behind the Heavy you are expected to locate important and dangerous targets and eliminate them. Lights are also still at full strength when fighting in close quarters underground or inside buildings. Melee classes, very basic soldier classes, and most fast classes with auto-dodge fall here. Merc soldiers, who are not sniping, are here because they add attacks to the combat but are not a threat worth dedicating fire to. Melee Cyber Knights, Mind Melters, and other melee classes are expected to charge enemy artillery and stab optics, stun button mage’s heads, drop fusion blocks in the joints of robots or just climb on and cut the pilot out from the safety of their blind spots. Mages that use low level attack spells and buffing spells will often find themselves doing the same job as other Light characters.

As for tactics it is generally important to use the correct level of response to most threats. Unlike D&D where engagements do not cost you anything so long as you survive resources are harder to come by in rifts. So if at all possible pick your fights. A group of bandits on the road are better handled by the party’s Light players and Bio-Regenerators. Lights can more easily replace their armor, and psychic and magic shielding will absorb the bandits low MD to mitigate the cost of such a venture.

If your group has multiple power armor, robots, etc. they are in little danger of being ambushed but will have a very hard time fighting in doors or underground. It is generally best for a party to only have one giant robot, if any as they are expensive to maintain, and power armor pilots should look for suits with detachable wings and missile pods. For power armor I recommend acquiring a giant MDC shield as it is much cheaper to replace/repair. If anyone in the group is willing to play an operator, psi-tech, or specialize themselves as a mechanic/engineer it can go a long way towards cheapening combat for the whole group.

Magic is your friend, use it! Unless the group is decidedly against magic it is best to take advantage of some simple buffs. Invisibility will leave many opponents unable to effectively fight back. Magical Adrenal Rush, Giant, and Speed Weapon can turn your melee characters into monsters with 14 attacks per melee round or 28 if they have paired weapons (5 normal +2 adrenal rush, doubled by speed weapon and doubled again by having paired weapons). Spells like Armor of Ithan, Armor Bizarre, and Impervious to Energy can make your party nice and tanky without costing much. Just remember to read the rules on magic there are allot of ways to get enough PPE to cast two or three big spells per combat, or a dozen of the cheap ones.

Remember that most enemies that are using MD weapons and armor cannot themselves do MD. If one of your players has the psychic power Kinesis it can be useful to disarm your opponents, and if anyone in your group is playing a melee fighter disarming can also be viable for you. Once disarmed, most enemies will have no way to deal damage to your group. Spells that trap enemies, neural maces which can stun your opponent, and anything that knocks you down can have the desired effect of capitalizing on a fight’s action economy. Most opponents will have 4-6 actions per melee round. Things like Horror Factor can remove one action from you at the beginning of each melee round. Remember that the same thing works on your opponent so use it. Knock down effects also remove an action, and require another to stand, but also drop an opponent to the bottom of the initiative.

In my experience the best mix for a group is one or two utility characters and two to three combat characters. If you have a group of five and everyone wants to play a combat character I recommend one Artillery, one or two Heavy, and two or three Light. Psionics are not necessary but it is very helpful for one guy to have Sixth Sense, Presence Sense, and See the Invisible. Magic is recommended for at least one character, or two characters with vastly different styles. This break down allows the group to work well in the open and in close quarters, and also helps to give allot of options.

Power Tiers, from least to most, for High Powered Combat Oriented Rifts Earth Campaigns.

5th Tier (none combat and basic troops): Rogue Scholar, Rogue Scientist, Cyber-Doc, City Rat, Body Fixer, Saloon Bum, Saloon Girl, Vagabond, Wilderness Scout, Merc Soldier, Operator, Dog-Boy, all civilian classes, and any military class that has no special abilities.

4th Tier (elite troops and low MDC creatures): Cyber-Knight, most psychic classes, Combat Magi, Ley-Line Walkers, normal Mystics, most Samurai and Ninjas, Crazies, Juicers, most native americans, lightly armored cyborgs, all western gunmen, most intelligent D-Bees, animal D-Bees with less than 500 MDC, any military footslogger with one or two good special abilities, and tier 5 characters with access to dimension book arms.

3rd Tier (high MDC threats and dangerous magic): Power Armor Pilot, Glitter Boy, Mystic Knights, heavily armored cyborgs, Baby Dragon, Robot Pilot, Shifter, High Magus, Lord Magus, native americans with powerful fetishes, Most D-bees with impressive abilities and high MDC (200-1000), combos between a MDC RCC and a Tier 4 OCC, most characters with super powers, and tier 4 characters with access to dimension book arms.

2nd Tier (the most power any player should have): Godlings, most Adult Dragons, Techno-Wizards (unless they have been reined in or neglected), highly optimized robots, small spacecraft, very high level magic casters, and most creatures with 2.5-5k MDC.

1st Tier (subjective and NPC): anything more powerful.

Be careful with this though. Most classes are not optimized and can jump tiers with a little work. example: a starting Psi-Tech is at the lesser end of tier 4, however if they can get access to power armor pilot elite and a SAMAS they can jump strait to tier 2.

c# – What design pattern would I be using for multiple DLLs using the same data but processing it with different classes

I’m re-writing my software from scratch and instead of hardcoding the processing libraries I decided to take a look at dynamic interfaces. But even the examples I found were not explicit in what I wanted to do. I’d like to write the management thread processes once then load each of the libraries on a thread dynamically using the same method calls in each of the libraries. That way I wouldn’t have to duplicate code. I was thinking of using Generic but that doesn’t appear to be compatible with dynamic interfaces.

How it’s used…

I have a set of data that I pull from a DB. I need to push that data to different systems using different processes, but the same method names.

So I would have common methods between methods, two of which would look like this:
InitializeConnector();
ProcessData(MyDataType incomingdata);

So in practical usage (prototyped):

REST Service 1 data processing

public class RestService1
{
    public bool InitializeConnector()
    {
        do stuff here...
    }

    public bool ProcessData( MyDataType incomingDataType)
    {
        ... process data here
    }

 }

REST Service 2 data processing (not all connection services are REST but this is the example)

public class RestService2
{
    public bool InitializeConnector()
    {
        do stuff here...
    }

    public bool ProcessData( MyDataType incomingDataType)
    {
        ... process data here
    }

 }

Master thread class:

foreach (data in dataList)
{
     if (data.type == dataType.rest1)
         dynamicClass.ProcessData(data);
     ....

     // or better yet something like this
     dataType.rest1.ProcessData(data);
     ...             
}

Am I better off hard coding the implementation or is there a dynamic implementation that can be used?

I will be spinning up multiple threads to process the data. So each of these processes would be running on it’s own thread and I’ll have a master thread to “Schedule” the processing in each of the threads.

The whole idea is to drop in new processing DLLs to link to other systems, but all using the same calls and the same.

java – statistics classes with number and object inputs

I’m a little bit confused by how you decided to structure and approach this.

From what I can see, StatisticalWithoutWeight and StatisticalWithWeight are actually the same thing but you decided to treat them different for some reason. At least from your example, everything boils down to Numbers. So what you very likely want, is a single class, with no interfaces, which accepts a single Object that can tell the class what value to use.

public interface DataPoint {
    public int getStatisticalValue();
}

public class Statistical {
    public Double getMean();
    public Double getMedian();
    public Double getSum();
    public Double getStandardDeviation();
    public List<T> getData();
    public void add(DataPoint dataPoint);
}

With that in place, you can create yourself a convenience DataPoint:

public class ProvidingDataPoint implements DataPoint {
    public <TYPE> ProvidingDataPoint(TYPE instance, IntFunction<TYPE> valueProvider);
}

That would allow you to do:

statistical.add(new ProvidingDataPoint(person, (person) -> person.getAge()));

Or with a convenience method on statistical itself:

statistical.add(person, Person::getAge);

Of course, that’s not perfect. Ideally, DataPoint would return a BigDecimal. Overall, your usage of Double is odd, I’d expect either ints or BigDecimal, given that you do your calculations already in that you might as well provide the user of your class with the more precise values.


Thinking a little bit more about it, a better alternative would most likely be to have the provider of values added to the Statistical class and specialize it on a single type of value, like this:

public class Statistical<DATAPOINT_TYPE> {
    public Statistical(Function<DATAPOINT_TYPE, BigDecimal> valueProvider);
    public BigDecimal getMean();
    public BigDecimal getMedian();
    public BigDecimal getSum();
    public BigDecimal getStandardDeviation();
    public List<DATAPOINT_TYPE> getData();
    public Statistical<DATAPOINT_TYPE> add(DATAPOINT_TYPE datapoint);
}

That means that you can use it like this:

Statistical<Person> statistical = new Statistical<>((person) -> person.getAge());
statistical.add(personA);

As said before, I’d expose all values as BigDecimal to provide the user of the class with most precision.


    public List<T> getData() {
        return values;
    }

You’re exposing internal state through this. Somebody can use the returned List to add Objects without having to call add, which might or might not be wanted.

Ideally, you’d return a Collections.unmodifiableList(values) here, or a copy.


MathContext mc = new MathContext(10);

Unlikely, yes, but could still not be enough depending on what values are being sampled.


Having talked about that you should not expose internal state and that you should control adding values through the add function, it might be beneficial to cache some of these values when possible, so that multiple calls to the function do not recalculate the values. Otherwise I’d make clear that the operation might be expensive, for example by naming the methods correctly calculateMean.