Unlike if-then and if-then-else statements, the switch statement can have a number of possible execution paths. A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Enum Types), the String class, and a few special classes that wrap certain primitive types: Character, Byte, Short, and Integer (discussed in Numbers and Strings).
The body of a switch statement is known as a switch block. A statement in the switch block can be labeled with one or more case or default labels. The switch statement evaluates its expression, then executes all statements that follow the matching case label.
Deciding whether to use if-then-else statements or a switch statement is based on readability and the expression that the statement is testing. An if-then-else statement can test expressions based on ranges of values or conditions, whereas a switch statement tests expressions based only on a single integer, enumerated value, or String object.
Another point of interest is the break statement. Each break statement terminates the enclosing switch statement. Control flow continues with the first statement following the switch block. The break statements are necessary because without them, statements in switch blocks fall through: All statements after the matching case label are executed in sequence, regardless of the expression of subsequent case labels, until a break statement is encountered. The program SwitchDemoFallThrough shows statements in a switch block that fall through. The program displays the month corresponding to the integer month and the months that follow in the year:
Technically, the final break is not required because flow falls out of the switch statement. Using a break is recommended so that modifying the code is easier and less error prone. The default section handles all values that are not explicitly handled by one of the case sections.
In Java SE 7 and later, you can use a String object in the switch statement's expression. The following code example, StringSwitchDemo, displays the number of the month based on the value of the String named month:
The String in the switch expression is compared with the expressions associated with each case label as if the String.equals method were being used. In order for the StringSwitchDemo example to accept any month regardless of case, month is converted to lowercase (with the toLowerCase method), and all the strings associated with the case labels are in lowercase.
Note: This example checks if the expression in the switch statement is null. Ensure that the expression in any switch statement is not null to prevent a NullPointerException from being thrown.
Injection-site reactions may be a consideration for switching from one GLP-1 receptor agonist to another. Injection frequency appears to be a factor; for example, there were fewer injection-site reactions with once-weekly compared with twice-daily exenatide (42). However, formulation may also play a role; there were fewer injection-site reactions with dulaglutide and subcutaneous semaglutide once weekly (35,43), and also with liraglutide once daily (38), compared with exenatide once weekly.
Avoidance of hypoglycemia is also a potential consideration for switching treatments, but there are no head-to-head data indicating any advantage of one GLP-1 receptor agonist over any other in terms of the incidence of hypoglycemia. In general, the risk of hypoglycemia is low with all GLP-1 receptor agonists (17).
Dissatisfaction with treatment frequency may be a reason for patients not to adhere fully to their prescribed regimen and may be ameliorated by a switch from a once- or twice-daily to a once-weekly GLP-1 receptor agonist. Several patient surveys indicate a preference for less frequent dosing with GLP-1 receptor agonists, specifically for once-weekly over once-daily dosing, in both injection-naive and injection-experienced patients (49,50). Patient-reported outcomes data from clinical trials in Japanese patients indicated that patients considered less frequent injections more convenient and flexible (51) and that their use led to an improvement in quality of life, without compromising glycemic control (52).
Kaplan-Meier analysis of persistence among patients switching from a previous GLP-1 receptor agonist to dulaglutide once weekly, exenatide twice daily or once weekly, or liraglutide once daily. Patients were switched from dulaglutide (5.0%), exenatide twice daily (28.1%), exenatide once weekly (17.4%), or liraglutide (49.5%). Data are from a retrospective analysis of a German prescription database using data from 1 February 2014 to 31 March 2017. Reprinted with permission from Otto et al. (57). BID, twice daily; QW, once weekly.
Cost is also a potential consideration for HCPs and patients. In situations in which patients cover the cost of treatment, or when insurance coverage is available only for select therapies, financial considerations may influence the selection of GLP-1 receptor agonist therapy or trigger the need for a switch. In a meta-analysis of 34 published trials, higher diabetes-related pharmacy and total health care costs for patients who were more adherent and persistent were offset by lower diabetes-related and all-cause medical costs (45). In a U.S. database study, diabetes-related total costs were not significantly different between dulaglutide once weekly and liraglutide once daily, but dulaglutide once weekly was associated with higher costs than exenatide once weekly (59).
We recommend assessing patients for GI symptoms attributable to GLP-1 receptor agonists, such as nausea, vomiting, dyspepsia, or changes in bowel habit. Other medications used for diabetes management (e.g., metformin or acarbose) may exacerbate these symptoms and intolerance for GLP-1 receptor agonists (60). For patients who have experienced GI adverse events, consider withholding medications in a stepwise manner to determine the causative agent or facilitate tolerance of the GLP-1 receptor agonist. Before switching because of GI intolerance, we recommend ensuring that all reasonable mitigating actions have been implemented, including: 1) verifying that the patient is taking the prescribed dose of the current GLP-1 receptor agonist because dose reduction can often minimize or resolve GI symptoms; 2) ensuring adherence to the provided dietary recommendations (consuming smaller portions and avoiding high-fat foods can decrease symptoms); and 3) trying other mitigating measures without success (e.g., use of natural antinausea supplements such as ginger or peppermint, implementation of a short-course liquid diet, or temporarily holding metformin if appropriate). The authors do not recommend pharmacotherapy to alleviate nausea.
Switching from a short-acting to a long-acting GLP-1 receptor agonist could lead to small transient increases in FPG, as shown in the DURATION-1 trial (61). Additional published clinical evidence for this is lacking. However, an exposure-response modeling analysis suggested that an initial deterioration in A1C may be seen when switching from dulaglutide 1.5 mg once weekly or liraglutide 1.2/1.8 mg once daily to the initial recommended 0.25 mg once-weekly dose of subcutaneous semaglutide (62). However, after this initial rebound, switching to subcutaneous semaglutide would be expected to result in additional reductions in A1C and weight compared with the other GLP-1 receptor agonists (60). In our experience, transient increases in glucose levels seen with changing from a once-daily to a once-weekly GLP-1 receptor agonist are not clinically significant. Nevertheless, the starting dose of the new GLP-1 receptor agonist can be adjusted to minimize the potential for such increases (Figure 2). Patients, particularly those who actively self-monitor their glucose levels, should be made aware of this possibility so they can inform their care team as necessary. If glucose levels rise above patient-specific goals, consideration can be given to temporarily adjusting existing diabetes medications or adding in other medications if needed. Explaining this to patients also serves as an educational opportunity to highlight the relationship between dietary patterns and blood glucose levels.
It is important to consider the timing of a switch between treatments. Patients tolerating once-daily GLP-1 receptor agonist therapy at the maximal therapeutic dose should start a once-weekly GLP-1 receptor agonist the day after their last dose of once-daily medication. Those who are not tolerating the maximal dose, or are switching to a once-weekly GLP-1 receptor agonist because of GI adverse effects, should stop the once-daily medication and wait until their symptoms have resolved before starting the lowest dose of the chosen weekly GLP-1 receptor agonist.
Before, during, and after switching treatments, patient communication and reinforcement of educational messages are vital to ensure a smooth transition. Given that different GLP-1 receptor agonists have different dosing recommendations (Table 1), it is important that patients switching between such agents are counseled on any applicable changes to their previous regimen. The usual recommendations and guidance that would be given for initiation of a once-weekly GLP-1 receptor agonist should be provided (e.g., direction to take the medication once weekly, information on how to manage missed doses, device-specific instructions, mealtime considerations, appropriate timing for oral medications, storage instructions, and availability of programs supporting adherence) (63).
Patients should be advised of the potential for experiencing GI adverse effects after switching to a different GLP-1 receptor agonist and that (as with the initiation of the prior GLP-1 receptor agonist) they should expect these effects to improve over time. They should seek medical advice if such adverse effects are severe, or occur for an extended period, so that their provider may consider dose adjustment (when applicable), discontinuation, or alternative therapies (63). 2b1af7f3a8