This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 모든 수형에 대해 builder 패턴을 제공하기 위해 사용 : Kotlin 의 apply method 와 같다 */ | |
implicit class AnyRefExtension[T <: AnyRef](underlying: T) { | |
def build(builder: T => T): T = builder(underlying) | |
def let(procedure: T => Unit): Unit = procedure(underlying) | |
} | |
/** 모든 Option 에 대해 Kotlin 의 let 과 같은 기능을 제공한다 */ | |
implicit class OptionExteions[T](underlying: Option[T]) { | |
def let(procedure: T => Unit): Unit = underlying foreach { procedure } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PagerActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_paper); | |
ViewPager pager = (ViewPager) findViewById(R.id.pager); | |
pager.setAdapter(new PageAdapter(getSupportFragmentManager())); | |
} |