Replaced all instances of Guava's Optional type with Java 8's Optional type, as discussed in #81. (#90)

This commit is contained in:
shartte
2016-08-24 19:06:10 +02:00
committed by Sebastian Hartte
parent c2a239a12f
commit e276aa682f
65 changed files with 306 additions and 468 deletions
@@ -167,10 +167,8 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, ITick
{
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
this.setInventorySlotContents( 0, charged );
}
materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged ->
this.setInventorySlotContents( 0, charged ) );
}
}
}
@@ -209,10 +207,8 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, ITick
{
this.extractAEPower( this.getInternalMaxPower(), Actionable.MODULATE, PowerMultiplier.CONFIG );// 1500
for( final ItemStack charged : materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).asSet() )
{
this.setInventorySlotContents( 0, charged );
}
materials.certusQuartzCrystalCharged().maybeStack( myItem.stackSize ).ifPresent( charged ->
this.setInventorySlotContents( 0, charged ) );
}
}
}
@@ -144,21 +144,15 @@ public class TileCondenser extends AEBaseInvTile implements IFluidHandler, IConf
switch( (CondenserOutput) this.cm.getSetting( Settings.CONDENSER_OUTPUT ) )
{
case MATTER_BALLS:
for( final ItemStack matterBallStack : materials.matterBall().maybeStack( 1 ).asSet() )
{
return matterBallStack;
}
return materials.matterBall().maybeStack( 1 ).orElse( null );
case SINGULARITY:
for( final ItemStack singularityStack : materials.singularity().maybeStack( 1 ).asSet() )
{
return singularityStack;
}
return materials.singularity().maybeStack( 1 ).orElse( null );
case TRASH:
default:
return null;
}
return null;
}
public double getRequiredPower()
@@ -399,11 +399,11 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
{
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orNull() ) ) && // and...
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orNull() ) );
final boolean matchA = ( plateA == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateA, recipe.getTopOptional().orElse( null ) ) ) && // and...
( plateB == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateB, recipe.getBottomOptional().orElse( null ) ) );
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orNull() ) ) && // and...
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orNull() ) );
final boolean matchB = ( plateB == null && !recipe.getTopOptional().isPresent() ) || ( Platform.isSameItemPrecise( plateB, recipe.getTopOptional().orElse( null ) ) ) && // and...
( plateA == null && !recipe.getBottomOptional().isPresent() ) | ( Platform.isSameItemPrecise( plateA, recipe.getBottomOptional().orElse( null ) ) );
if( matchA || matchB )
{