22 lines
618 B
Java
Raw Normal View History

package com.iluwatar.privateclassdata;
2015-05-23 15:52:50 +03:00
2015-05-23 16:07:04 +03:00
/**
*
* Immutable stew class, protected with Private Class Data pattern
*
*/
2015-05-23 15:52:50 +03:00
public class ImmutableStew {
private StewData data;
public ImmutableStew(int numPotatoes, int numCarrots, int numMeat, int numPeppers) {
data = new StewData(numPotatoes, numCarrots, numMeat, numPeppers);
}
public void mix() {
System.out.println(String.format(
"Mixing the immutable stew we find: %d potatoes, %d carrots, %d meat and %d peppers",
data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers()));
}
2015-05-23 15:52:50 +03:00
}