Java tutorial
//package com.java2s; //License from project: Apache License import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import java.io.Serializable; public class Main { public static Bundle pack(@NonNull final Bundle bundle, @NonNull final String key, @Nullable final Serializable serializable) { if (serializable != null) { bundle.putSerializable(key, serializable); } return bundle; } public static Bundle pack(@NonNull final String key, @Nullable final Serializable serializable) { final Bundle bundle = new Bundle(); return pack(bundle, key, serializable); } }